LCF .data changes at reboot

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LCF .data changes at reboot

Jump to solution
715 Views
ignisuti
Contributor IV

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?

0 Kudos
1 Solution
652 Views
ignisuti
Contributor IV

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.

View solution in original post

0 Kudos
2 Replies
652 Views
JimDon
Senior Contributor III

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?

0 Kudos
653 Views
ignisuti
Contributor IV

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.

0 Kudos