SHARE VARIABLE BETWEEN BOOT MODES

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
90670
Level 4
Level 4
25 replies posted 25 sign-ins 10 questions asked

Hi everyone, I'm using XMC4700 board and want to have some shared variables between normal boot mode and ABM0, ABM1 boot mode, so I can check the flag status to switch boot mode. I tried to store variable in flash and modify it using pointer to flash address but it doesn't work. How can I do this task?

0 Likes
2 Replies
ncbs
Moderator
Moderator
Moderator
500 replies posted 50 likes received 250 sign-ins

Hi @90670,

When we shift between boot modes, the device is issued with power on reset (PORST). This means that the variables stored in RAM will be lost on PORST. If you need to store any variable prior to change in boot modes, you could store them in flash.

Can you read the flash contents before switching boot modes to verify if your data is stored. After switching the boot modes, read the same location again to see the contents are there. Let me know your observation.

[EDIT]: Boot modes can also be changed through system resets, which do not involve PORST. Here, we get more boot mode options to choose from - Normal, ASC BSL, BMI, CAN BSL, PSRAM boot, ABM-0, ABM-1 and Fallback ABM, unlike with PORST where we get only - Normal, ASC BSL, BMI, CAN BSL.

Regards,
Nikhil

0 Likes
90670
Level 4
Level 4
25 replies posted 25 sign-ins 10 questions asked

Hi @ncbs , yeah I can store data into flash but I cannot modify it during run time when switching boot mode. 

I have another idea, maybe I can determine which bootmode to use by checking some GPIO pins, that would be easier. 

But I have another problem is the flash loader. How can I store new firmware to flash (through UART or SPI, I can transmit data but I don't know how to store data into flash during runtime). I read some example and see that PSRAM mode maybe suitable. Because when code is running from PSRAM, it can modify flash at runtime right?

My idea is store flash loader program into flash, then copy it into PSRAM when executing bootloader, then bootloader jump into PSRAM boot mode to execute flash loader program to load new firmware into flash at ABM0 or ABM1 region. Then jump into ABM0 or ABM1 boot mode to run new firmware.

The problem is I still cannot copy flash loader program from flash into PSRAM to execute PSRAM boot mode. I success in copying PSRAM header from flash to last 32 bytes of PSRAM, but flash loader code is not. I use loop and pointer to do the job. I can copy from flash to DSRAM but cannot copy from flash to PSRAM.

90670_0-1666261547636.png

 

0 Likes