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.

Why my boot_load doesn't work?

Hi guys,

I have a question, i can't have my boot_loader work.

I just want my boot_loader to lauch application at a specified location, and it doesn't work.

The MCU i use is LX4F230H5QR.

Here is what i have done.

1. Build Boot_loader and burn it with LM Flash Programmer with offset 0, checked "erase entire flash"

2. Build Application and burn it with LM Flash Programmer with offset 0x1000, checked "erase necessary pages"

Below is the .icf files for Boot_loader

//
// Define a memory region that covers the entire 4 GB addressible space of the
// processor.
//
define memory mem with size = 4G;

//
// Define a region for the on-chip flash.
//
define region FLASH = mem:[from 0x00000000 to 0x0003ffff];

//
// Define a region for the on-chip SRAM.
//
define region SRAM = mem:[from 0x20000000 to 0x20007fff];

//
// Indicate that the sections containing the boot loader code should be
// initialized by copying.
//
initialize manually with packing = none { section INTVEC };
initialize manually with packing = none { section CODE };
initialize manually with packing = none { section .text };
initialize manually with packing = none { section .rodata };
initialize manually with packing = none { section .data };

keep { section INTVEC };
keep { section INTVEC_init };

//
// Indicate that the noinit values should be left alone. This includes the
// stack, which if initialized will destroy the return address from the
// initialization code, causing the processor to branch to zero and fault.
//
do not initialize { section .noinit };

//
// Place the interrupt vectors at the start of flash/SRAM.
//
place at start of FLASH { readonly section INTVEC_init };
place at start of SRAM { readwrite section INTVEC };

//
// Place the remainder of the read-only items into flash/SRAM.
//
place in FLASH { readonly section CODE_init };
place in SRAM { readwrite section CODE };
place in FLASH { readonly section .text_init };
place in SRAM { readwrite section .text };
place in FLASH { readonly section .rodata_init };
place in SRAM { readwrite section .rodata };
place in FLASH { readonly section .data_init };
place in SRAM { readwrite section .data };
place in FLASH { readonly };

//
// Place all read/write items into SRAM.
//
place in SRAM { readwrite };

Below is the icf file for my Application

/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x00000000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x00001000;
define symbol __ICFEDIT_region_ROM_end__ = 0x0003FFFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
define symbol __ICFEDIT_region_RAM_end__ = 0x20007FFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x800;
define symbol __ICFEDIT_size_heap__ = 0x2000;
/**** End of ICF editor section. ###ICF###*/

define memory mem with size = 4G;
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];

define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };

initialize by copy { readwrite };
do not initialize { section .noinit };

place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place in ROM_region { readonly };
place in RAM_region { readwrite,
block CSTACK, block HEAP };

I just use the bl_main file in the boot_loader.

As i don't need anything to be done in boot_loader except launch application from specified location.

So i disable the UART, SSI, USB and so on.

But once i build the project, it gives error.

Linking
Error[Li005]: no definition for "ConfigureDevice" [referenced from D:\AmazonRecorder\AmazonBootLoader\ewarm\Obj\bl_startup_ewarm.o]
Error[Li005]: no definition for "Updater" [referenced from D:\AmazonRecorder\AmazonBootLoader\ewarm\Obj\bl_startup_ewarm.o]
Error while running Linker

So i have to enable below in bl_config.h

//#define UART_ENABLE_UPDATE

So it can pass compilation.

Also i disable erverything in updater function of bl_main.

But the boot_loader still can't start the application.

Can someone give me some suggestion?

  • Aaron,

    You might want to start with the boot_loader.icf file under StellarisWare/boot_loader, then for the application icf file, just take one from one of the example projects under StellarisWare/boards/ek-lm4f232.

     

  • Hi Reagan,

    Thanks for you reply.

    I have finished the Application part of my project, and it runs well.

    Now i focus on the Boot_loader part, Below is my project needs, would you first help review whether it is feasible?

    1. Write a Boot_loader program, under the Boot_loader program it will read a specified MCU flash location for Application location

    2. After get the Application Location, BootLoader will jump to run Application

    3. In the Application program, when i get a update command, i will write the application to another location of the MCU flash and save the address in a specified MCU flash Location, which will used by BootLoader for next time boot.

    And i am now focus on BootLoader part.

    I am really confused about the BootLoader Program, and i just don't know how to get it work.

    Would you please help take a look whether my .icf file is correct?

    First comes the Application .icf file, it is just copied from the example as you mentioned.

    I leave the first 0x1000 for BootLoader.

    //*****************************************************************************
    //
    // usb_dev_bulk.icf - Linker configuration file for usb_dev_bulk.
    //
    // Copyright (c) 2011-2012 Texas Instruments Incorporated. All rights reserved.
    // Software License Agreement
    //
    // Texas Instruments (TI) is supplying this software for use solely and
    // exclusively on TI's microcontroller products. The software is owned by
    // TI and/or its suppliers, and is protected under applicable copyright
    // laws. You may not combine this software with "viral" open-source
    // software in order to form a larger program.
    //
    // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
    // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
    // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
    // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
    // DAMAGES, FOR ANY REASON WHATSOEVER.
    //
    // This is part of revision 9453 of the EK-LM4F232 Firmware Package.
    //
    //*****************************************************************************

    //
    // Define a memory region that covers the entire 4 GB addressible space of the
    // processor.
    //
    define memory mem with size = 4G;

    //
    // Define a region for the on-chip flash.
    //
    define region FLASH = mem:[from 0x00001000 to 0x0003ffff];

    //
    // Define a region for the on-chip SRAM.
    //
    define region SRAM = mem:[from 0x20000000 to 0x20007fff];

    //
    // Define a block for the heap. The size should be set to something other
    // than zero if things in the C library that require the heap are used.
    //
    define block HEAP with alignment = 8, size = 0x00000000 { };

    //
    // Indicate that the read/write values should be initialized by copying from
    // flash.
    //
    initialize by copy { readwrite };

    //
    // Indicate that the noinit values should be left alone. This includes the
    // stack, which if initialized will destroy the return address from the
    // initialization code, causing the processor to branch to zero and fault.
    //
    do not initialize { section .noinit };

    //
    // Place the interrupt vectors at the start of flash.
    //
    place at start of FLASH { readonly section .intvec };

    //
    // Place the remainder of the read-only items into flash.
    //
    place in FLASH { readonly };

    //
    // Place the RAM vector table at the start of SRAM.
    //
    place at start of SRAM { section VTABLE };

    //
    // Place all read/write items into SRAM.
    //
    place in SRAM { readwrite, block HEAP };

    Then comes the BootLoader's .icf file, which comes from StellarisWare/boot_loader, i modify them a little, marked in red

    //*****************************************************************************
    //
    // bl_link.icf - Linker script for EW-ARM.
    //
    // Copyright (c) 2007-2012 Texas Instruments Incorporated. All rights reserved.
    // Software License Agreement
    //
    // Texas Instruments (TI) is supplying this software for use solely and
    // exclusively on TI's microcontroller products. The software is owned by
    // TI and/or its suppliers, and is protected under applicable copyright
    // laws. You may not combine this software with "viral" open-source
    // software in order to form a larger program.
    //
    // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
    // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
    // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
    // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
    // DAMAGES, FOR ANY REASON WHATSOEVER.
    //
    // This is part of revision 9453 of the Stellaris Firmware Development Package.
    //
    //*****************************************************************************

    //
    // Define a memory region that covers the entire 4 GB addressible space of the
    // processor.
    //
    define memory mem with size = 4G;

    //
    // Define a region for the on-chip flash.
    //
    define region FLASH = mem:[from 0x00000000 to 0x0003ffff];

    //
    // Define a region for the on-chip SRAM.
    //
    define region SRAM = mem:[from 0x20000000 to 0x20007fff];

    //
    // Indicate that the sections containing the boot loader code should be
    // initialized by copying.
    //
    initialize manually with packing = none { section INTVEC };
    initialize manually with packing = none { section CODE };
    initialize manually with packing = none { section .text };
    initialize manually with packing = none { section .rodata };
    initialize manually with packing = none { section .data };

    keep { section INTVEC };
    keep { section INTVEC_init };

    //
    // Indicate that the noinit values should be left alone. This includes the
    // stack, which if initialized will destroy the return address from the
    // initialization code, causing the processor to branch to zero and fault.
    //
    do not initialize { section .noinit };

    //
    // Place the interrupt vectors at the start of flash/SRAM.
    //
    place at start of FLASH { readonly section INTVEC_init };
    place at start of SRAM { readwrite section INTVEC };

    //
    // Place the remainder of the read-only items into flash/SRAM.
    //
    place in FLASH { readonly section CODE_init };
    place in SRAM { readwrite section CODE };
    place in FLASH { readonly section .text_init };
    place in SRAM { readwrite section .text };
    place in FLASH { readonly section .rodata_init };
    place in SRAM { readwrite section .rodata };
    place in FLASH { readonly section .data_init };
    place in SRAM { readwrite section .data };
    place in FLASH { readonly };

    //
    // Place all read/write items into SRAM.
    //
    place in SRAM { readwrite };

    Is above .icf files correct?

  • Aaron,

    If I were you, I might just take a separate approach to this altogether. You shouldn't have to touch the linker scripts at all. It's just if you want to put your application at 0x1000, then use LM Flash Programmer with the .bin file that was created with the default .icf linker script. Download the boot loader code first at offset 0x0000, then the application after at 0x1000. There is another post about how to do this here http://e2e.ti.com/support/microcontrollers/stellaris_arm_cortex-m3_microcontroller/f/471/p/210950/778175.aspx