I had read the boot modes of NIos II ,I want to know the boot sequence of Nios II based HAL,In the doucount of Altera,It said that if boot without boot_loader ,the crt0.s deal with boot ,see crt0.s code ,the sequence is1.flush instruction cache; 2.initial BSS region. 3.call _start function to flush data cache; 4.call alt_load() to copy .rwdata and .rodata to RAM; 5.call alt_main(); if boot from falsh,Altera said that will call boot_loader before _start call.the boot_loader also flush instruction cache.I wonder the flush Icache is same with crt0.S?and when to call boot_loader?I couldn't get the boot code with boot_loader. In addition .what is the BSS region
Hi gerger,> I wonder the flush Icache is same with crt0.S?and when to call boot_loader? I'm not sure I understand your question exactly, but both the boot loader and crt0 initialize the icache. The last time I checked, the loader does not initialize dcache ... it just uses the ld/st io instructions. > In addition .what is the BSS region Uninitialized data ... the stuff that is supposed to be set to zero before calling main(). Regards, --Scott
thanks smcnutt,your understand is right ,->but both the boot loader and crt0 initialize the icache. your mean if they initialize the icache at different times?
Hi gerger,> your mean if they initialize the icache at different times? If you use the bootloader, it will initialize the icache, relocate your code, then jump to your application entry point (in most cases: _start in crt0). When the loader relocates your code, the data cache is not initialized. When the entry point in crt0 is called by the loader, the crt0 code will initialize the icache (again), then initialize the dcache. Regards, --Scott
Hi smcnutt!I see.if I use the boot_loader in reset address. after reset ,the reset pointer is boot_loader,boot_loader will copy the programm(crt0) to onchip RAM and relocate my code. the jump entry point of crt0.the crt0 code will initialize the icache (again), then initialize the dcache.then call alt_main(). I had misunderstand before you reply.I had thought first run crto,then call boot_loader. In addtion. boot_loader only copy crt0 and .text to RAM ? or it copy all programm image (include crto, .text, .rwdata, .rodata) to RAM? Thanks.
Hi gerger,> In addtion. boot_loader only copy crt0 and .text to RAM ? > or it copy all programm image (include crto, .text, .rwdata, .rodata) to RAM? I should copy everything -- but all of my applications run completely in RAM (I do not locate rodata in flash for example) -- so I'm not sure how it behaves if you locate rodata in non-volatile memory. Regardless, as I recall, the "data" that the boot loader operates on is formatted as a sequence of records (length, destination address, data). The loader just fetches the length, and destination, then transfers the following bytes. When the length is zero, the copy process is complete. If you need more details, you should probably "use the force" ;-) and review the source code -- You might also want to get some details on how elf2flash works, since this is where the bootloader is married to your application code. Regards, --Scott