2025-01-28 01:17 AM
Hello all, I am trying to start my application after uploading it over UART with STM32CubeProgrammer CLI.
My command looks like this:
STM32_Programmer_CLI -c port=COM8 baudrate=115200 -w LED_Blink.bin 0x08010000 --verify --go 0x08010000
But my program is not starting (I don't see the LED blinking). But if I do a power cycle, the program starts normally.
In the future I would need the program to start after it was uploaded without a power cycle. Has anyone had the same issue? Or am I missing something?
2025-01-28 01:34 AM - edited 2025-01-28 01:37 AM
when you power reset the mcu(systembootloader) it jumps to 0x08000000 instead of 0x08010000 right?
maybe you just forgot to apply the NVIC offset and the linker script in your blinky code.
When you hard reset it probably is executing old residual code you have at yout 0x8000000 address
To verify this, fully erase your flash memory and try again your CLI command based blinky upload, it wont work wth the Go command and it wont work with the hard reset either.
2025-01-28 01:43 AM
Yes, I forgot to apply the NVIC offset in the linker script and I did not know that I have to change the VTOR.
Here is the solution that worked for me:
Set the VTOR to my application address
SCB->VTOR = 0x08010000;
Set the NVIC offset to my application address in the FLASH.ld file:
FLASH (rx) : ORIGIN = 0x08010000, LENGTH = 2048K
2025-01-28 01:51 AM - edited 2025-01-28 01:52 AM
I wouldnt change it like that,
Go to the system c file (in my case right now is: "system_stm32g4xx.c")
And apply the vector offset there, i need a lot more context to judge if your quick fix works as intended.
/************************* Miscellaneous Configuration ************************/
/* Note: Following vector table addresses must be defined in line with linker
configuration. */
/*!< Uncomment the following line if you need to relocate the vector table
anywhere in Flash or Sram, else the vector table is kept at the automatic
remap of boot address selected */
/* #define USER_VECT_TAB_ADDRESS */
#if defined(USER_VECT_TAB_ADDRESS)
/*!< Uncomment the following line if you need to relocate your vector Table
in Sram else user remap will be done in Flash. */
/* #define VECT_TAB_SRAM */
#if defined(VECT_TAB_SRAM)
#define VECT_TAB_BASE_ADDRESS SRAM_BASE /*!< Vector Table base address field.
This value must be a multiple of 0x200. */
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
This value must be a multiple of 0x200. */
#else
#define VECT_TAB_BASE_ADDRESS FLASH_BASE /*!< Vector Table base address field.
This value must be a multiple of 0x200. */
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
This value must be a multiple of 0x200. */
#endif /* VECT_TAB_SRAM */
#endif /* USER_VECT_TAB_ADDRESS */
/******************************************************************************/
Some smt32 families dont support this vector offseting, (for example F0).
So https://community.st.com/t5/stm32-mcus-embedded-software/how-to-boot-to-random-address-without-vect-tab-offset-stm32f072/td-p/170227
2025-01-28 02:25 AM
I tried your solution, but I can't get my program to run.
My system_stm32h7xx.c looks like this now:
#if defined(USER_VECT_TAB_ADDRESS)
#if defined(DUAL_CORE) && defined(CORE_CM4)
/*!< Uncomment the following line if you need to relocate your vector Table
in D2 AXI SRAM else user remap will be done in FLASH BANK2. */
/* #define VECT_TAB_SRAM */
#if defined(VECT_TAB_SRAM)
#define VECT_TAB_BASE_ADDRESS D2_AXISRAM_BASE /*!< Vector Table base address field.
This value must be a multiple of 0x400. */
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
This value must be a multiple of 0x400. */
#else
#define VECT_TAB_BASE_ADDRESS FLASH_BANK2_BASE /*!< Vector Table base address field.
This value must be a multiple of 0x400. */
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
This value must be a multiple of 0x400. */
#endif /* VECT_TAB_SRAM */
#else
/*!< Uncomment the following line if you need to relocate your vector Table
in D1 AXI SRAM else user remap will be done in FLASH BANK1. */
/* #define VECT_TAB_SRAM */
#if defined(VECT_TAB_SRAM)
#define VECT_TAB_BASE_ADDRESS D1_AXISRAM_BASE /*!< Vector Table base address field.
This value must be a multiple of 0x400. */
#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.
This value must be a multiple of 0x400. */
#else
#define VECT_TAB_BASE_ADDRESS FLASH_BANK1_BASE /*!< Vector Table base address field.
This value must be a multiple of 0x400. */
#define VECT_TAB_OFFSET 0x00010000U /*!< Vector Table base offset field.
This value must be a multiple of 0x400. */
#endif /* VECT_TAB_SRAM */
#endif /* DUAL_CORE && CORE_CM4 */
#endif /* USER_VECT_TAB_ADDRESS */
2025-01-28 02:53 AM
I forgot to uncomment
#define USER_VECT_TAB_ADDRESS
in the "system_stm32h7xx" file.
Now everything is working as expected.
2025-01-28 03:59 AM