Dual Bank programming

Discussions concerning TrueSTUDIO for STM32 9.0.0 and later versions.

Moderators: Markus Girdland, Mattias Norlander

sohamjani
Posts: 2
Joined: Fri Mar 09, 2018 3:31 pm

Dual Bank programming

Postby sohamjani » Fri Mar 09, 2018 3:46 pm

I'm trying to build a 2 images that can be flashed on the 2 banks that my MCU has.
The dev board is Nucleo-L152RE which has bank 1 at address is 0x08000000 and bank 2 at 0x08040000.
I would like to know how I can build images with the start addresses varying between the two above. What (compiler, linker) settings am I looking at?
Also, is there an address independent approach that Truestudio provides ?

Note: I'am not going to use ST-Link to program the board, but the STM32CubeProgrammer software over UART.

Thank you.

Sigi
Posts: 6
Joined: Mon Mar 12, 2018 7:37 am

Re: Dual Bank programming

Postby Sigi » Mon Mar 12, 2018 8:07 am

Check ST's app. guide on IAP programming, since there you will find explanation and example how to reallocate code to different address.

weifeng.li
Posts: 6
Joined: Fri Mar 16, 2018 3:44 am

Re: Dual Bank programming

Postby weifeng.li » Thu Apr 12, 2018 4:11 am

not quite understand your case. but Atollic support the compile option "-fPIE", for more information, please check page 163 in user manual
and also, you can put any file to any address. just check the LD's document

sohamjani
Posts: 2
Joined: Fri Mar 09, 2018 3:31 pm

Re: Dual Bank programming

Postby sohamjani » Thu Apr 12, 2018 5:07 pm

Thank you for this information. This is exactly what I was looking for.

I was looking to generate position independent code/image which will allow me to flash the code to either bank of the MCU. I needed this because I was implementing firmware-over-the-air update where the MCU(in-app) would place the new image/binary into the other bank.

Although a binary is always position independent, I wanted to make sure that it does not cause a problem with relocating the vector table and other reset handlers.

As an alternative technique, I was changing the Flash address in the "startup_stm32l152rexe.s" file to the apt address i wanted.

I know "KEIL IDE" provides he same functionality in a very GUI like manner with options to produce images tailored to a particular start address. I was looking for something similar.

Mechi
Posts: 5
Joined: Tue Jan 01, 2019 7:49 am

Re: Dual Bank programming

Postby Mechi » Thu Jan 03, 2019 8:47 am

weifeng.li wrote:not quite understand your case. but Atollic support the compile option "-fPIE", for more information, please check page 163 in user manual
and also, you can put any file to any address. just check the LD's document


I found it on page 173 in Atollic_TrueSTUDIO_for_ARM_User_Guide.pdf
    POSITION INDEPENDENT CODE
    When for instance working on a bootloader, position independency is a great help. PIC
    (Position Independent Code) is relative to the program counter. If it is compiled for
    address 0 but placed at 0x81000 it still runs properly.
    The compiler has an option -fPIE that enables the compiler to generate position
    independent code for executable


Return to “TrueSTUDIO for STM32 discussions”

Who is online

Users browsing this forum: No registered users and 2 guests