Loading...
 

SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world. And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download (registration required) various documents highlighting:

System Workbench for STM32


Bootloader and application code imlepentation

Hello,

I work on a project where I implemented a bootloader and an application code. The bootloader program was written in Keil environment (K), and tha application code was written in System Workbench for STM32 environment (S).
I work with STM32F407 controller and the memory organization that I set is the folowing:

-starting address of bootloader vector table is 0x08000000, after that following the program
-starting address of application vector table is 0x08008000, after that following the program

I set the application vector table in the SCB->VTOR to 0x08008000, and in the linker set the loading address to same.

MEMORY
{
FLASH (rx)  : ORIGIN = 0x8008000, LENGTH = 992K
RAM (xrw)  : ORIGIN = 0x20000000, LENGTH = 128K
CCMRAM (rw)  : ORIGIN = 0x10000000, LENGTH = 64K
}

I read that with these settings the program should work correctly, but if I built it and programmed both bootloader and application code to the right address, the bootloader program crashes. It didn’t find the application code.


I wrote a little test application code in K and if built it and programmed it in to the application area the bootloader knew it and jumped to the application code.

So I think that the problem comming from the S environment binary file generation, or bad settings of the linker script. Can You help me where I took the mistake? The project deadline comming soon and I need the solution as fast as possible.

Please help me to get the error together.

Kind regards,
Szabolcs

Change is correct, but bootloader set MSP?

In the bootloader program set the MSP too with __set_MSP(0x08008000).

And if debug step from step the bootloader change the MSP correctly.

I think that the problem isn’t in the bootloader if it worked with another test application mentioned above.

__set_MSP(0x08008000) this is wrong ....


sholud be casted to poiter.

__set_MSP((uint32_t *)0x08008000)


__set_MSP(0x08008000) this is wrong

should be

__set_MSP( * (uint32_t * )0x08008000)


France

Hi,

How does your bootloader checks that there is a valid application to launch? I presume it reads a few words at specific addresses (usually at the very beginning of the application) to check that it looks like a valid application (starting e.g. with a known code sequence or a valid vector table) or even compute a CRC to check th ecode was not corruted.

That means that your application binary file layout may depend on the toolchain used (especially on the startup code provided by the toolchain) so you may have to adapt your bootloader or “mimic” the Keil-generated header so that the bootloader “thinks” it was generated by the Keil toolchain.

Hope this helps,

Bernard (Ac6)


Helllo,

On the bootloader side I din’t implement the CRC check yet, but in the future I will implement. I think that first sholud work the jumping feature from bootloader program to the application program. When I uploaded the binary file via web browser the bytes that was wrote to the flash exactly agree with the binary file bytes, so I think that this is not a problem. Of course necessary the CRC, but I would like to activate first the jumping section. In the browser side the CRC check was implemented, and when will implement in the botloader side just will check that the two CRC value is equals or not.

What can I do in the interest of the bootloader “thinks” that the application code was generated From Keil toolchain?
Sholud I copy the first few bytes from a Keil generated binary file to the begginning of my application’s binary file?

Please help me,
Szabolcs


I show you your mistake, BIG mistake.

Which compiler is used for application doesn’t matter. It is imposible to check which one is used from binary.


probably You jump to wrong adsress, set wrong MSP (what you are doinig),


Thank You Your advice the mistake was really in the address.
With the below code section the bootloader get the correct address and works fine.

typedef void (*pFunction)(void);

pFunction Jump_To_Application;
uint32_t JumpAddress;

JumpAddress = *(__IO uint32_t*) (START_ADDR + 4);
Jump_To_Application = (pFunction) JumpAddress;
set_MSP(*(IO uint32_t*) START_ADDR);
Jump_To_Application();

Kind regards,
Szabolcs

Hello ,

I am working with the same code using Keil and i have the similar problem with ” Jump_To_Application” .
I have set the vector table offset to application address .What do you mean by setting the loading address in linker , how do you do that ?