We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hallo!
I have boot loader written in asm and have to translate it to C-language (probably with asm inserts) to simplify life for successors. Keil does the following: a) for the very first code, it always put jump instruction to transfer control to either generated C_STARTUP code section (if no startup asm module in the project) or to the startup asm module if it was added to the project b) puts all associated startup code to the executable c) generates jump back to main()
00000000 FA000800 JMPS ?C_STARTUP(0x8) ... 00000XXX FA000400 JMPS main(0x4)
Questions: 1) Is there any way to avoid this jump instructions, suppress startup code generation and just have "plain" compiler output 2) This plain executable should be aligned to the adress (FA60h) at which I need to place my bootloader entry point
So, the idea is how to get rid of all the code not written by you, i.e. with no any piece of code added by IDE s/w.
Does anybody have answers?
Thanks & Regards, Nikolay.
Hey Nikolay,
Thank you for taking the trouble of following up on your own post and sharing what you've found. Nice netiquette!
Some thoughts I had about this:
We are not using the IDE at all (editor + GNU make instead) but apparently the IDE/linker requires a startup file (which we have so no problems there)? I haven't been able to find a directive to turn this off. But it got me thinking, would it be possible to rename your main.c file to c_startup.c ?
Your startup file does contain some other definitions/symbols (stack, etc.) but I guess you could put them in the same .c file using #pragma asm.
I'm not sure if it would be possible to rename the module name from inside a .c file. It's normally just the filename, see http://www.keil.com/support/man/docs/c166/c166_ap_sgc.htm That way you could make a single bootloader.c that contains some symbol definition asm from the startup file and is renamed to C_STARTUP to keep the linker happy.
[...]
Ah, take a look at: http://www.keil.com/support/man/docs/l166/l166_name.htm
You could do it using the linker like so:
C166 bootloader.c L166 bootloader.obj NAME(C_STARTUP) NOVECTAB
Not sure it this works though :-)
Thanks for the NOVECTAB/NOVT directive, didn't know it yet.
Good luck.
Kind regards, Joost
Hmm, the linker directive NAME from http://www.keil.com/support/man/docs/l166/l166_name.htm seems to do something different. It's a module name (?) (not the output file name) of the resulting absolute image file.