LCF .data changes at reboot

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

LCF .data changes at reboot

跳至解决方案
1,017 次查看
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 项奖励
回复
1 解答
954 次查看
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 项奖励
回复
2 回复数
954 次查看
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 项奖励
回复
955 次查看
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 项奖励
回复