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
  • Hi Scott,

    Thanks for the idea.....I was a very good one!!...and I works a treat.

    Here is what I did:

    1. Created new file bootloader.s with the following in it:

    AREA Bootloader, CODE, READONLY

    INCBIN .\\Zone_Pod_Bootloader\obj\PodBootloader.bin

    END

    This is great because it takes the binary from it's associated bootloader project.

    2. Modified the scatter file as follows:

    LR_IROM2 0x00000800 0x0001F800 { ; load region size_region ER_IROM2 0x00000800 0x0001F800 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } RW_IRAM1 0x20000000 0x00003F80 { ; RW data efm32_msc.o (+RO) .ANY (+RW +ZI) }
    }

    LR_IROM1 0x00000000 0x00000800 { ER_IROM1 0x00000000 0x00000800 { ; load address = execution address bootloader.o (+RO) }
    }

    I have tried it and it works great, I have been able to get the application and the bootloader to work (in different circumstances). I can also step through using the debugger and even single step through the bootloader assembly code (not that I should need to).

    I can't thank you enough.
    If your even in Ireland give me a shout and I'll buy you a pint!!

    Ian

Reply
  • Hi Scott,

    Thanks for the idea.....I was a very good one!!...and I works a treat.

    Here is what I did:

    1. Created new file bootloader.s with the following in it:

    AREA Bootloader, CODE, READONLY

    INCBIN .\\Zone_Pod_Bootloader\obj\PodBootloader.bin

    END

    This is great because it takes the binary from it's associated bootloader project.

    2. Modified the scatter file as follows:

    LR_IROM2 0x00000800 0x0001F800 { ; load region size_region ER_IROM2 0x00000800 0x0001F800 { ; load address = execution address *.o (RESET, +First) *(InRoot$$Sections) .ANY (+RO) } RW_IRAM1 0x20000000 0x00003F80 { ; RW data efm32_msc.o (+RO) .ANY (+RW +ZI) }
    }

    LR_IROM1 0x00000000 0x00000800 { ER_IROM1 0x00000000 0x00000800 { ; load address = execution address bootloader.o (+RO) }
    }

    I have tried it and it works great, I have been able to get the application and the bootloader to work (in different circumstances). I can also step through using the debugger and even single step through the bootloader assembly code (not that I should need to).

    I can't thank you enough.
    If your even in Ireland give me a shout and I'll buy you a pint!!

    Ian

Children
No data