Hi,
I know this topic got several question answered already but I also want to be sure I got the informations right
I use in my work two boards:
- Development board NUCLEO-F439ZI, I added an external clock but no other modification
- Custom Board with a STM32F439ZI, built by my coworker
We used the stm32cube environment and we’re looking to slowly migrate to mbed. This leads to having codes compiled in two build environment (I made sure to have them use the exact same compiler). The code has been made as minimal as possible during my digging and is as follows:
int main() {
while(1){
HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_12);
HAL_Delay(100);
}
}
Of course the code in the stm32cube make the initialization of clocks and pins explicit but I didn’t put them here for readability purpose.
I then saw strange behaviour. The NUCLEO could run the two codes but the custom board could run the stm32cube code while failing to run the mbed code.
I first made sure the two board were as close as possible and it turned out the pin BOOT0 was left unconnected on the custom board. Unconnecting it in the NUCLEO board gave the same behaviour as the custom board.
The datasheet gives the following table:
The NUCLEO has his pin BOOT0 connected to the ground leading to have the code starting in the main flash memory.
The custom board has his pin BOOT0 unconnected and the BOOT1 pin connected to the ground leading the code to start in the system memory.
Investigating more I have found that the start address for the RAM is not the same in stm32cube environment and mbed (next lines taken from respectives .map files):
- stm32:
Name Origin Length Attributes
CCMRAM 0x10000000 0x00010000 xrw
RAM 0x20000000 0x00030000 xrw
FLASH 0x08000000 0x00200000 xr
*default* 0x00000000 0xffffffff
- mbed:
Name Origin Length Attributes
FLASH 0x08000000 0x00200000 xr
CCM 0x10000000 0x00010000 xrw
RAM 0x200001b0 0x0002fe50 xrw
*default* 0x00000000 0xffffffff
This post (link) indicates that the mbed offset is to give the availability of dynamic vector table.
I think this offset is the reason why the code from st works on the custom board and no the code from mbed.
My first question is simple. Did I get something wrong?
Based on what I found and know I see several possibilities to solve the problem:
- Redesign the hardware to connect the BOOT0 pin. Easiest solution by farwith the big downside that a new board needs to be produced (long time before being able to manipulate the board, even longer with the current component shortage)
- Retarget the address jumped to from 0x2000 0000 to 0x2000 01b0. I’m not sure it’s possible
- Modify mbedOS to remove this dynamic vector table. This is out of the picture obviously but I’m putting it here anyway.
Second question now : Did I missed something?
Followed by : Are the solution 2 and 3 even possible? Is there any other way to solve my problem?
I’m sorry if the solution 3 seems a bit desperate. I’ve been non stop looking for this problem for the last 2 weeks and I’m starting to feel out of civilized option (outside of solution 1 of course).
Best regards,
ABR