![]() ![]() Simonetta wrote: I don't believe that it is a good idea to put custom code in front of a bootloader. A JMP would be better, how can I accomplish that? I tried asm("jmp _program_start"), which the linker rejects with an unknown-symbol error. I believe there is another problem: How can I resume the regular entry code? In my current code, I call a function _program_start(), which appears correct (linker finds that function) but of course, this results in a CALL, which seems unwise when the stack pointer hasn't been initialised yet. I suppose I could run a disassembly and add my code manually - but surely there's a more elegant way. There is no trace of my programme code anywhere in the resulting binary code. The project builds fine, but doesn't work. _program_start() /* Resume regular entry code */ If (*pu32StartupCode = 0xDECAFBAD) /* Programmers need proper coffee!!! */Īsm("jmp 0") /* Execute main application */ Uint32_t *pu32StartupCode = (uint32_t *)0x2000 /* Read 32-bit uint from RAMSTART */ I wrote my own startup function and changed the program entry symbol accordingly. I found the linker setting to override the default program entry function alright. Once my custom startup code got executed, I'd like the CPU to either return to the default startup code, or JMP 0x0000, which is where the main application sits, depending on the content of SRAM address 0x2000. I want to add some custom startup code, which shall be executed by the CPU first thing after the reset vector. The code is a flashloader, which sits at FLASH address 0x8000. So, here's what I want to do: I have an existing project for an XMega64A controller, in IAR AVR EW. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |