application start address

Post here first, or if you can't find a relevant section!
omaroski
Posts: 11
Joined: Mon Apr 03, 2023 5:36 pm

Re: application start address

Post by omaroski »

Don't know, don't have the right knowledge to link (no pun intended) the missing dots :D

However if I replace this line :

Code: Select all

_estack = ORIGIN(RAM) + LENGTH(RAM)
;

with this:

Code: Select all

_estack = 0x2001c000;


the application (simple blink) starts from address I set.

All the rest is almost the same.

The memory declaration remains the same as with STM files except from LD_FLASH_OFFSET replaced by offset 0x8000:

Code: Select all

MEMORY
{
  CCMRAM    (xrw)    : ORIGIN = 0x10000000,   LENGTH = 64K
  RAM    (xrw)    : ORIGIN = 0x20000000,   LENGTH = LD_MAX_DATA_SIZE
  FLASH    (rx)    : ORIGIN = 0x8000000 + 0x8000, LENGTH = LD_MAX_SIZE - 0x8000
}
Do you think I can declare LD_FLASH_OFFSET in build_opt.h file? Still have to try that.

Thank you
Omar
User avatar
Vassilis
Posts: 24
Joined: Wed Dec 18, 2019 3:04 pm
Location: Thessaloniki, Greece
Contact:

Re: application start address

Post by Vassilis »

An easy way to do that is to modify only the boards.txt file by adding the following 2 lines:
# DISCO_F407VG board
Disco.menu.pnum.DISCO_F407VG=STM32F407G-DISC1
Disco.menu.pnum.DISCO_F407VG.node=DIS_F407VG
Disco.menu.pnum.DISCO_F407VG.upload.maximum_size=1048576
Disco.menu.pnum.DISCO_F407VG.upload.maximum_data_size=131072
Disco.menu.pnum.DISCO_F407VG.build.mcu=cortex-m4
Disco.menu.pnum.DISCO_F407VG.build.fpu=-mfpu=fpv4-sp-d16
Disco.menu.pnum.DISCO_F407VG.build.float-abi=-mfloat-abi=hard
Disco.menu.pnum.DISCO_F407VG.build.board=DISCO_F407VG
Disco.menu.pnum.DISCO_F407VG.build.series=STM32F4xx
Disco.menu.pnum.DISCO_F407VG.build.product_line=STM32F407xx
Disco.menu.pnum.DISCO_F407VG.build.variant=STM32F4xx/F407V(E-G)T_F417V(E-G)T
Disco.menu.pnum.DISCO_F407VG.build.cmsis_lib_gcc=arm_cortexM4lf_math
Disco.menu.pnum.DISCO_F407VG.build.flash_offset=0x8000
Disco.menu.pnum.DISCO_F407VG.build.st_extra_flags=-D{build.product_line} {build.enable_usb} {build.xSerial} -DVECT_TAB_OFFSET={build.flash_offset}
It would be better not to modify any core file like "system_stm32f4xx.c"

Of course, you could add a new custom board, but there is a known bug in Arduino IDE V2.00 - 2.04 that does not update the menu with the new board. But it works with legacy Arduino IDE version 1.8.19
Vassilis Serasidis
https://www.serasidis.gr
User avatar
fpiSTM
Posts: 1746
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: application start address

Post by fpiSTM »

There are 2 SRAM: SRAM1 and SRAM2.
They are contiguous so normally, you should have 112k(SRAM1) + 16k(SRAM2).
Setting the estack at 0x2001 C000 is to use only SRAM1. Maybe a config issue on your board.
omaroski
Posts: 11
Joined: Mon Apr 03, 2023 5:36 pm

Re: application start address

Post by omaroski »

Vassilis wrote: Wed Apr 05, 2023 7:56 pm An easy way to do that is to modify only the boards.txt file by adding the following 2 lines:
# DISCO_F407VG board
Disco.menu.pnum.DISCO_F407VG=STM32F407G-DISC1
Disco.menu.pnum.DISCO_F407VG.node=DIS_F407VG
Disco.menu.pnum.DISCO_F407VG.upload.maximum_size=1048576
Disco.menu.pnum.DISCO_F407VG.upload.maximum_data_size=131072
Disco.menu.pnum.DISCO_F407VG.build.mcu=cortex-m4
Disco.menu.pnum.DISCO_F407VG.build.fpu=-mfpu=fpv4-sp-d16
Disco.menu.pnum.DISCO_F407VG.build.float-abi=-mfloat-abi=hard
Disco.menu.pnum.DISCO_F407VG.build.board=DISCO_F407VG
Disco.menu.pnum.DISCO_F407VG.build.series=STM32F4xx
Disco.menu.pnum.DISCO_F407VG.build.product_line=STM32F407xx
Disco.menu.pnum.DISCO_F407VG.build.variant=STM32F4xx/F407V(E-G)T_F417V(E-G)T
Disco.menu.pnum.DISCO_F407VG.build.cmsis_lib_gcc=arm_cortexM4lf_math
Disco.menu.pnum.DISCO_F407VG.build.flash_offset=0x8000
Disco.menu.pnum.DISCO_F407VG.build.st_extra_flags=-D{build.product_line} {build.enable_usb} {build.xSerial} -DVECT_TAB_OFFSET={build.flash_offset}
It would be better not to modify any core file like "system_stm32f4xx.c"

Of course, you could add a new custom board, but there is a known bug in Arduino IDE V2.00 - 2.04 that does not update the menu with the new board. But it works with legacy Arduino IDE version 1.8.19
Thank you, this is helpful. I will try with the legacy IDE
omaroski
Posts: 11
Joined: Mon Apr 03, 2023 5:36 pm

Re: application start address

Post by omaroski »

fpiSTM wrote: Thu Apr 06, 2023 7:31 am There are 2 SRAM: SRAM1 and SRAM2.
They are contiguous so normally, you should have 112k(SRAM1) + 16k(SRAM2).
Setting the estack at 0x2001 C000 is to use only SRAM1. Maybe a config issue on your board.
Ok thank you, I've noticed that, so I should set it to 0x2001FFFF (or 0x20020000 ?) to include SRAM2
User avatar
fpiSTM
Posts: 1746
Joined: Wed Dec 11, 2019 7:11 pm
Answers: 91
Location: Le Mans
Contact:

Re: application start address

Post by fpiSTM »

It seems it's not work as by default estack is set to 128k. So set it to 112k if it works.
Post Reply

Return to “General discussion”