This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Example of the Linker Command file for bootloader+application



Hi, I'm trying to build the project that includes bootloader + application. So I want the CCS to build a binary that includes both.

Here is a linker command file that I'm trying to use: 

#define BL_BASE  0x00000000
#define AP_BASE  0x00001000
#define RAM_BASE 0x20000000

MEMORY
{
    /* Application stored in and executes from internal flash */
    BL_FLASH (RX) : origin = BL_BASE,  length = 0x00001000
    AP_FLASH (RX) : origin = AP_BASE,  length = 0x0000f000
    /* Application uses internal RAM for data */
    SRAM (RWX)    : origin = 0x20000000, length = 0x00018000
}

SECTIONS
{
    .boot_ivecs:   > BL_BASE
    .boot_flash:   > BL_BASE
    .app_ivecs :   > AP_BASE
    .text      :   > AP_FLASH
    .const     :   > AP_FLASH
    .cinit     :   > AP_FLASH
    .pinit     :   > AP_FLASH
     .vtable    :   > RAM_BASE
    .data      :   > SRAM
    .bss       :   > SRAM
    .sysmem    :   > SRAM
    .stack     :   > SRAM
}

I defined all Bootloader function with #pragma CODE_SECTION (foo, ".boot_flash"), and bootloader interrupt vector table with boot_ivecs. But for some reason bootloader code isn't placed after the bootloader interrupt vector table. 
Ideal solution for me would be placing objects at a specific location:
SECTIONS
{
    .boot:
    {
        bootloader_start.obj
        bootloader.obj
    } > BL_FLASH
    .app_ivecs :   > AP_BASE
    .text      :   > AP_FLASH
    .const     :   > AP_FLASH
    .cinit     :   > AP_FLASH
    .pinit     :   > AP_FLASH
    .vtable    :   > RAM_BASE
    .data      :   > SRAM
    .bss       :   > SRAM
    .sysmem    :   > SRAM
    .stack     :   > SRAM
}
but this also doesn't work well for me. Only bootloader intvect table is being placed at the 0x0000 location. Rest of the code is placed at the AP_BASE (0x1000). 
I don't really care about startup code, since the bootloader is pretty small and simple. and I'm going to initialize all variables in the code. 
Can anybody recommend an example that includes bootloader + application in once project (or highlight a mistake in mine)?
Can I have 2 startup codes (for bootloader and the application) in one build?
Am I trying to do something that is doable, or I should give up and stick with two separate builds/projects - bootloader and application.
Thanks!