This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Adding bootloader binary to C project

Hi all,

I see this is a common problem, I am using uVision 4 with an ARM 7.

I have a bootloader at location 0x0 and application code that is located at 0x800.
I currently use HEX2BIN and BIN2HEX to merge the files before I can downloaded them to the target.
However to I would like to debug the application with the bootloader included as a binary.
Is there a way the linker can add the bootloader binary (or HEX file) during the build?
I would like to keep the two projects separate.
I'm looking at using bin2c.exe to create a header file with the bootloader as a const array, but this seems silly when it's the linkers job to combine object and library files together, why not also link an external hex or bin file.

Any ideas please.

Thanks,

Ian

Parents
  • Hello everyone,

    from what I read this topic is closest to my problem but not quite what i need, though maybe someone can redirect me in correct way.

    how to generate HEX array from bootloader code which I would be able to insert in to existing code. At the moment working program have working bootloader saved in HEX array and stored in bootloader memory area. Thought it was generated with old version of keil. And now if I try to generate HEX from same working(not yet edited) bootloader code with newer Keil I get different HEX array and it isn't working. I'm making HEX array the following way: Code in Kail generated to *.HEX then using "Hex Workshop v6.6" to import that hex and export it to *.c

    Is it anything i need to do in other way or i'm missing something or something else?

    Program starts as usual at 0x0001 0000

    bootloader array at 0x0000 0000

    thank you in advance.

Reply
  • Hello everyone,

    from what I read this topic is closest to my problem but not quite what i need, though maybe someone can redirect me in correct way.

    how to generate HEX array from bootloader code which I would be able to insert in to existing code. At the moment working program have working bootloader saved in HEX array and stored in bootloader memory area. Thought it was generated with old version of keil. And now if I try to generate HEX from same working(not yet edited) bootloader code with newer Keil I get different HEX array and it isn't working. I'm making HEX array the following way: Code in Kail generated to *.HEX then using "Hex Workshop v6.6" to import that hex and export it to *.c

    Is it anything i need to do in other way or i'm missing something or something else?

    Program starts as usual at 0x0001 0000

    bootloader array at 0x0000 0000

    thank you in advance.

Children
  • Hi Lauris

    Not exactly sure what you want to do but here is what I do, not sure if this will help you...

    1. I have a separate project with the bootloader in it (could be like your old one).
    2. I use fromelf.exe (in batch file) to generate a binary file from the .axf file (if you have the old bootloader hex file you could use hextobin.exe instead).
    3. In my project I have an assembly file that uses the INCBIN directive.
    4. I have a scatter file that places the bootloader.o at 0x00000000 and the rest at 0x00000800

    Works a treat for me, I only have to assemble the bootloader project and run the bin conversion if it changes.

    Hope that is of help..good luck

    Ian

  • Thought it was generated with old version of keil. And now if I try to generate HEX from same working(not yet edited) bootloader code with newer Keil I get different HEX array and it isn't working.

    Then no, this thread is not dealing with the problem you have, because you've already applied a solution to the problem discussed here, and it seems to work.

    The problem you have is that your bootloader no longer works if you re-compile it with newer tools. That's most likely a problem with your bootloader source code. Whatever that problem is, it would be better to discuss it in a separate thread, because it is unrelated to the topic of this one.