Forum Discussion
Altera_Forum
Honored Contributor
21 years agoFor my custom board, I finally got around to putting u-boot and my C application both in the flash. With just u-boot in the flash, it would start up when the board was powered. With both in the flash, my app starts up instead - not what I expected.
My flash is 0x0 to 0x800000. My sram is 0x800000 to 0xA00000. My reset vector is 0x0. My exception vector is 0x800020. u-boot is flashed at 0x0 and linked to run at 0x9d0000. My app image is flashed at 0x400000 and linked with the default NiosII bootstrap to run at 0x800000. I used u-boot to flash both images and verify the locations (not the IDE flash programmer), so I they should be where I think they are. The u-boot boot process seems to be start.S -> board_init() -> main_loop(). As far as I can tell, when I power cycle my board board_init() is never reached and my app is loaded and executed instead. If I erase the section of flash where my app resides, then u-boot begins normally again. I don't see anything in start.S that would explain this behavior. Somehow it is jumping to some location below the app image in flash (0x400000) and above the u-boot image in order to invoke the app bootstrap routine. To test, I load u-boot over jtag and made sure to clear sram before my tests so I am not accidentally re-executing previously loaded code. I can then try one of: ==> go 0 ;starts u-boot (the go bug is fixed) ==> reset ;starts u-boot (power cycle) ;app starts ==> go 400000 ;app starts I see that u-boot has all kinds of options related to autobooting of images, but I don't think they are enabled. I should at least get to main_loop() and see some u-boot prompt before this happens anyway. I've a few more things to try before I gut my project to make room for the hw debugger, but would appreciate any insight.