I'm trying to create my first bootloader and have assigned specific objects to specific memory addresses.
My program seems to have a problem where it stops working once I reboot the unit. It works fine if I download code to it and then I can reset as many times as I want. If I kill the power and return it the unit starts having issues.
I've narrowed this down to specific .data section in my RAM. I export this section before powering down. Then, if I import this section after I reboot, it fixes the problem.
Can someone please help me understand why this is an issue and perhaps provide a suggestion for fixing this?
解決済! 解決策の投稿を見る。
I think I have this straightened out now.
The fact that the program stopped working after a hard reset was an indicator that my DATA segment wasn't being handled appropriately. The part of the startup code that was copying my DATA segment from Flash to RAM had a few issues. I ended up splitting my DATA and BSS segments up into protected and non-protected segments. This required me to re-write parts of the start-up code.
Like I said before, this is my first bootloader. I'd be interested in reading or discussing pros/cons to various strategies.
My bootloader needs SPI, UART, driver for LCD display, driver for External Flash, etc, etc... So, instead of duplicating code, I decided to share this common code between application and bootloader. This also allowed me to use a single project for application and bootloader. Normally, I see this split-up as two separate projects which seemed like a headache to me. I feel my solution is safe, but a bit on the complicated side.
I don't understand what you mean by:
"I export this section before powering down. Then, if I import this section after I reboot, it fixes the problem."
What do you mean by import and export in this context?
I think I have this straightened out now.
The fact that the program stopped working after a hard reset was an indicator that my DATA segment wasn't being handled appropriately. The part of the startup code that was copying my DATA segment from Flash to RAM had a few issues. I ended up splitting my DATA and BSS segments up into protected and non-protected segments. This required me to re-write parts of the start-up code.
Like I said before, this is my first bootloader. I'd be interested in reading or discussing pros/cons to various strategies.
My bootloader needs SPI, UART, driver for LCD display, driver for External Flash, etc, etc... So, instead of duplicating code, I decided to share this common code between application and bootloader. This also allowed me to use a single project for application and bootloader. Normally, I see this split-up as two separate projects which seemed like a headache to me. I feel my solution is safe, but a bit on the complicated side.