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.

Not able to load application file after GPMC NOR Boot Loader is loaded AM335x_SYSBIOS_Industrial_SDK_01.01.00.08

Other Parts Discussed in Thread: SYSBIOS

Hi, I have modified NOR ICE V1 boot loader program for beagle bone black and have been able successfully load the boot loader but I fail to load the application program in the NOR Flash. My application code is a simple gpioLEDBlink.c program where pin 23 of GPIO1 glows alternately

I create the Boot loader .bin using the given command:- (Do i need to rename it the .bin as boot.bin only before flashing????)

E:\SDK\am335x_sysbios_ind_sdk_1.1.0.8\sdk\tools\post_build\post_build.bat "C:\ti\ccsv6" "C:\ti\ccsv6\tools\compiler\ti-cgt-arm_5.2.2" "E:\SDK\am335x_sysbios_ind_sdk_1.1.0.8\sdk\starterware\binary\armv7a\cgt_ccs\am335x\evmAM335x\bootloader\NOR" "boot" "E:\SDK\am335x_sysbios_ind_sdk_1.1.0.8\sdk\tools\isdk_image" "0" "2" "0x08000000" "0x08000000"

I create the Application loader .bin using following command:- (Do i need to rename it the .bin as appl.bin only before flashing????)

C:\ti\am335x_sysbios_ind_sdk_1.1.0.8\sdk\tools\post_build\post_build.bat "C:\ti\ccsv6" "C:\ti\ccsv6\tools\compiler\ti-cgt-arm_5.2.2" "C:\ti\AM335X_StarterWare_02_00_01_01\binary\armv7a\cgt_ccs\am335x\beaglebone\gpio\Release" "gpioLEDBlink" "C:\ti\am335x_sysbios_ind_sdk_1.1.0.8\sdk\tools\isdk_image" "1" "2" "0x08003D00" "0x08003D00"

My Nor boot.cmd is as follows (I have given the length as 0X3D00 only):-

-l drivers.lib
-l platform.lib
-l utils.lib
-l libmmcsd.lib


/* SPECIFY THE SYSTEM MEMORY MAP */

MEMORY
{
        NOR_MEM         : org = 0x08000000  len = 0x3D00        // 0x10000 changed            /* RAM */
        IRAM_MEM        : org = 0x402F0400  len = 0x1FBFF       /* RAM */
}

/* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY */

SECTIONS
{
    .init    : {
                 bl_init.obj (.text)
               } load > 0x08000000
    .const   : load > NOR_MEM              /* GLOBAL CONSTANTS             */
    .cinit   : load > NOR_MEM
    .text    : load > NOR_MEM              /* CODE  */
    .ram_code: { bl_norexec.obj(.text)} load > NOR_MEM, run > 0x40300000
                 LOAD_START(ram_code_load_start)
                 RUN_START(ram_code_run_start)
                 SIZE(ram_code_size)

    .data    : load > IRAM_MEM              /* INITIALIZED GLOBAL AND STATIC VARIABLES. */
    .bss     : load > IRAM_MEM              /* UNINITIALIZED OR ZERO INITIALIZED */
                                            /* GLOBAL & STATIC VARIABLES.   */
                    RUN_START(bss_start)
                    RUN_END(bss_end)

    .stack   : load > 0x4030FF00            /* SOFTWARE SYSTEM STACK        */

}

I have glown LED 1 in the boot loader to understand that my boot loader has loaded successfully and it glows..

Finally my entry point in the Application code is as follows:-

    unsigned int sector;
    void (*appEntryNOR)();
    ti_header t_header;
    
    pinmux_NOR();

    ////////////////////////////////////////////////////////////////////////////
    t_header.magic_number = 0x00000000;
    t_header.image_size = 0x00000000;
    t_header.load_addr = 0x00000000;
    t_header.run_addr = 0x08003D00;

    appEntryNOR = (void (*)(void)) t_header.run_addr;
    (*appEntryNOR)( );

 

I do not knwo where I am making a mistake. Please help in this at the earliest... Thanks...

 

  • Hi,

    MOHIT HADA said:
    (Do i need to rename it the .bin as boot.bin only before flashing????)


    No, not required.

    MOHIT HADA said:
    "C:\ti\am335x_sysbios_ind_sdk_1.1.0.8\sdk\tools\isdk_image" "1" "2" "0x08003D00" "0x08003D00"


    Are you sure the Load and Run addresses are correct? Please cross-check in the map file.

    Regards,
    Vinesh

  • No Vinesh, still no output. I have seen the load address and run address is from the NOR device itself and they are same.... but i have not given any run command in the linker file.

    Linker and map file for the application code attached:-

    MEMORY
    {
    NOR_MEM : org = 0x08003D00 len = 0x3D00 // 0x10000 changed /* RAM */
    DDR_MEM : org = 0x80000000 len = 0x7FFFFFF /* RAM */
    }

    /* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY */

    SECTIONS
    {
    .text:Entry : load > 0x08003D00

    .text : load > NOR_MEM /* CODE */
    .const : load > NOR_MEM /* GLOBAL CONSTANTS */

    .data : load > 0x80000000 /* INITIALIZED GLOBAL AND STATIC VARIABLES */
    .bss : load > DDR_MEM /* UNINITIALIZED OR ZERO INITIALIZED */
    /* GLOBAL & STATIC VARIABLES */
    RUN_START(bss_start)
    RUN_END(bss_end)
    .stack : load > 0x87FFFFF0 /* SOFTWARE SYSTEM STACK */
    }



    ******************************************************************************
    TI ARM Linker PC v5.2.2
    ******************************************************************************
    >> Linked Wed Aug 19 10:17:40 2015

    OUTPUT FILE NAME: <../../../../../../../binary/armv7a/cgt_ccs/am335x/beaglebone/gpio/Release/gpioLEDBlink.out>
    ENTRY POINT SYMBOL: "Entry" address: 08003d00


    MEMORY CONFIGURATION

    name origin length used unused attr fill
    ---------------------- -------- --------- -------- -------- ---- --------
    NOR_MEM 08003d00 00003d00 000014e0 00002820 RWIX
    DDR_MEM 80000000 07ffffff 00000208 07fffdf7 RWIX


    SEGMENT ALLOCATION MAP

    run origin load origin length init length attrs members
    ---------- ----------- ---------- ----------- ----- -------
    08003d00 08003d00 000014e0 000014e0 r-x
    08003d00 08003d00 000000c8 000000c8 r-x .text:Entry
    08003dc8 08003dc8 00001398 00001398 r-x .text
    08005160 08005160 00000080 00000080 r-- .const
    80000000 80000000 00000200 00000000 rw-
    80000000 80000000 00000200 00000000 rw- .bss
    87fffff0 87fffff0 00000008 00000000 rw-
    87fffff0 87fffff0 00000008 00000000 rw- .stack


    SECTION ALLOCATION MAP

    output attributes/
    section page origin length input sections
    -------- ---- ---------- ---------- ----------------
    .text:Entry
    * 0 08003d00 000000c8
    08003d00 000000c8 system.lib : init.obj (.text:Entry)

    .text 0 08003dc8 00001398
    08003dc8 0000053c gpioLEDBlink.obj (.text)
    08004304 00000488 system.lib : cp15.obj (.text)
    0800478c 00000458 drivers.lib : gpio_v2.obj (.text)
    08004be4 00000180 rtsv7A8_A_le_n_eabi.lib : memcpy32.obj (.text)
    08004d64 00000124 platform.lib : gpio.obj (.text)
    08004e88 0000010c system.lib : exceptionhandler.obj (.text)
    08004f94 000000a4 rtsv7A8_A_le_n_eabi.lib : autoinit.obj (.text)
    08005038 00000084 : cpy_tbl.obj (.text)
    080050bc 00000060 system.lib : cpu.obj (.text)
    0800511c 00000044 : startup.obj (.text)

    .const 0 08005160 00000080
    08005160 00000046 gpioLEDBlink.obj (.const:oled_init_arr)
    080051a6 00000002 --HOLE-- [fill = 0]
    080051a8 00000038 system.lib : startup.obj (.const:vecTbl)

    .bss 0 80000000 00000200 UNINITIALIZED
    80000000 00000200 system.lib : interrupt.obj (.bss:fnRAMVectors)

    .TI.noinit
    * 0 80000000 00000000 UNINITIALIZED

    .stack 0 87fffff0 00000008 UNINITIALIZED
    87fffff0 00000008 --HOLE--


    GLOBAL SYMBOLS: SORTED ALPHABETICALLY BY Name

    address name
    ------- ----
    08004f7c AbortHandler
    08004760 CP15AuxControlFeatureDisable
    0800474c CP15AuxControlFeatureEnable
    080046f4 CP15BranchPredictionDisable
    080046e4 CP15BranchPredictionEnable
    080046d8 CP15BranchPredictorInvalidate
    08004714 CP15ControlFeatureDisable
    08004728 CP15ControlFeatureEnable
    080043f0 CP15DCacheClean
    08004528 CP15DCacheCleanBuff
    08004484 CP15DCacheCleanFlush
    0800457c CP15DCacheCleanFlushBuff
    08004320 CP15DCacheDisable
    0800434c CP15DCacheEnable
    0800435c CP15DCacheFlush
    080045d0 CP15DCacheFlushBuff
    08004704 CP15DomainAccessClientSet
    08004304 CP15ICacheDisable
    0800433c CP15ICacheEnable
    08004518 CP15ICacheFlush
    08004634 CP15ICacheFlushBuff
    080046a0 CP15MMUDisable
    080046b8 CP15MMUEnable
    08004774 CP15MainIdPrimPartNumGet
    08004694 CP15TlbInvalidate
    08004688 CP15Ttb0Set
    0800473c CP15TtbCtlTtb0Config
    080046cc CP15VectorBaseAddrSet
    08005118 CPUAbortHandler
    08005110 CPUSwitchToPrivilegedMode
    080050fc CPUSwitchToUserMode
    080050ec CPUfiqd
    080050dc CPUfiqe
    080050cc CPUirqd
    080050bc CPUirqe
    08003d00 Entry
    08004f78 FIQHandler
    08004de4 GPIO0ModuleClkConfig
    08004d90 GPIO1ModuleClkConfig
    08004d80 GPIO1Pin23PinMuxSetup
    08004d70 GPIO1PinMuxSetup
    0800429c GPIO2ModuleClkConfig
    08004278 GPIO2PinMuxSetup
    08004bc4 GPIOAutoIdleModeControl
    08004ba4 GPIODebounceFuncControl
    08004b98 GPIODebounceTimeConfig
    08004b80 GPIODirModeGet
    08004b5c GPIODirModeSet
    08004b3c GPIOGatingRatioConfigure
    08004b1c GPIOIdleModeConfigure
    08004acc GPIOIntTypeGet
    0800496c GPIOIntTypeSet
    0800495c GPIOModuleDisable
    0800494c GPIOModuleEnable
    08004930 GPIOModuleReset
    08004924 GPIOMultiplePinsRead
    08004918 GPIOMultiplePinsWrite
    080048f8 GPIOPinIntClear
    080048d8 GPIOPinIntDisable
    080048b8 GPIOPinIntEnable
    080048a0 GPIOPinIntStatus
    08004878 GPIOPinIntWakeUpDisable
    08004850 GPIOPinIntWakeUpEnable
    08004840 GPIOPinRead
    08004820 GPIOPinWrite
    0800480c GPIORawIntStatus
    08004804 GPIORevisionInfoGet
    080047e4 GPIOTriggerPinInt
    080047d4 GPIOWakeupGlobalDisable
    080047c4 GPIOWakeupGlobalEnable
    08004d64 GpioPinMuxSetup
    08004ecc IRQHandler
    080050ec IntMasterFIQDisable
    080050dc IntMasterFIQEnable
    080050cc IntMasterIRQDisable
    080050bc IntMasterIRQEnable
    UNDEFED SHT$$INIT_ARRAY$$Base
    UNDEFED SHT$$INIT_ARRAY$$Limit
    08004ea4 SVC_Handler
    08004f7c UndefInstHandler
    87fffff8 __STACK_END
    00000008 __STACK_SIZE
    UNDEFED __TI_CINIT_Base
    UNDEFED __TI_CINIT_Limit
    UNDEFED __TI_Handler_Table_Base
    UNDEFED __TI_Handler_Table_Limit
    08004f94 __TI_auto_init
    08003d00 __TI_static_base__
    08004be4 __aeabi_memcpy
    08004be4 __aeabi_memcpy4
    08004be4 __aeabi_memcpy8
    ffffffff __binit__
    ffffffff __c_args__
    87fffff0 __stack
    ffffffff binit
    80000200 bss_end
    80000000 bss_start
    08005038 copy_in
    80000000 fnRAMVectors
    080047a8 gpioContextRestore
    0800478c gpioContextSave
    08004208 main
    08004be4 memcpy
    08005160 oled_init_arr
    08004190 oled_powerup
    08004038 rect_fill
    08005148 start_boot
    08003f50 write_16
    08003e80 write_ctrl
    08003dc8 write_idx
    08003f38 write_param


    GLOBAL SYMBOLS: SORTED BY Symbol Address

    address name
    ------- ----
    00000008 __STACK_SIZE
    08003d00 Entry
    08003d00 __TI_static_base__
    08003dc8 write_idx
    08003e80 write_ctrl
    08003f38 write_param
    08003f50 write_16
    08004038 rect_fill
    08004190 oled_powerup
    08004208 main
    08004278 GPIO2PinMuxSetup
    0800429c GPIO2ModuleClkConfig
    08004304 CP15ICacheDisable
    08004320 CP15DCacheDisable
    0800433c CP15ICacheEnable
    0800434c CP15DCacheEnable
    0800435c CP15DCacheFlush
    080043f0 CP15DCacheClean
    08004484 CP15DCacheCleanFlush
    08004518 CP15ICacheFlush
    08004528 CP15DCacheCleanBuff
    0800457c CP15DCacheCleanFlushBuff
    080045d0 CP15DCacheFlushBuff
    08004634 CP15ICacheFlushBuff
    08004688 CP15Ttb0Set
    08004694 CP15TlbInvalidate
    080046a0 CP15MMUDisable
    080046b8 CP15MMUEnable
    080046cc CP15VectorBaseAddrSet
    080046d8 CP15BranchPredictorInvalidate
    080046e4 CP15BranchPredictionEnable
    080046f4 CP15BranchPredictionDisable
    08004704 CP15DomainAccessClientSet
    08004714 CP15ControlFeatureDisable
    08004728 CP15ControlFeatureEnable
    0800473c CP15TtbCtlTtb0Config
    0800474c CP15AuxControlFeatureEnable
    08004760 CP15AuxControlFeatureDisable
    08004774 CP15MainIdPrimPartNumGet
    0800478c gpioContextSave
    080047a8 gpioContextRestore
    080047c4 GPIOWakeupGlobalEnable
    080047d4 GPIOWakeupGlobalDisable
    080047e4 GPIOTriggerPinInt
    08004804 GPIORevisionInfoGet
    0800480c GPIORawIntStatus
    08004820 GPIOPinWrite
    08004840 GPIOPinRead
    08004850 GPIOPinIntWakeUpEnable
    08004878 GPIOPinIntWakeUpDisable
    080048a0 GPIOPinIntStatus
    080048b8 GPIOPinIntEnable
    080048d8 GPIOPinIntDisable
    080048f8 GPIOPinIntClear
    08004918 GPIOMultiplePinsWrite
    08004924 GPIOMultiplePinsRead
    08004930 GPIOModuleReset
    0800494c GPIOModuleEnable
    0800495c GPIOModuleDisable
    0800496c GPIOIntTypeSet
    08004acc GPIOIntTypeGet
    08004b1c GPIOIdleModeConfigure
    08004b3c GPIOGatingRatioConfigure
    08004b5c GPIODirModeSet
    08004b80 GPIODirModeGet
    08004b98 GPIODebounceTimeConfig
    08004ba4 GPIODebounceFuncControl
    08004bc4 GPIOAutoIdleModeControl
    08004be4 __aeabi_memcpy
    08004be4 __aeabi_memcpy4
    08004be4 __aeabi_memcpy8
    08004be4 memcpy
    08004d64 GpioPinMuxSetup
    08004d70 GPIO1PinMuxSetup
    08004d80 GPIO1Pin23PinMuxSetup
    08004d90 GPIO1ModuleClkConfig
    08004de4 GPIO0ModuleClkConfig
    08004ea4 SVC_Handler
    08004ecc IRQHandler
    08004f78 FIQHandler
    08004f7c AbortHandler
    08004f7c UndefInstHandler
    08004f94 __TI_auto_init
    08005038 copy_in
    080050bc CPUirqe
    080050bc IntMasterIRQEnable
    080050cc CPUirqd
    080050cc IntMasterIRQDisable
    080050dc CPUfiqe
    080050dc IntMasterFIQEnable
    080050ec CPUfiqd
    080050ec IntMasterFIQDisable
    080050fc CPUSwitchToUserMode
    08005110 CPUSwitchToPrivilegedMode
    08005118 CPUAbortHandler
    08005148 start_boot
    08005160 oled_init_arr
    80000000 bss_start
    80000000 fnRAMVectors
    80000200 bss_end
    87fffff0 __stack
    87fffff8 __STACK_END
    ffffffff __binit__
    ffffffff __c_args__
    ffffffff binit
    UNDEFED SHT$$INIT_ARRAY$$Base
    UNDEFED SHT$$INIT_ARRAY$$Limit
    UNDEFED __TI_CINIT_Base
    UNDEFED __TI_CINIT_Limit
    UNDEFED __TI_Handler_Table_Base
    UNDEFED __TI_Handler_Table_Limit

    [111 symbols]
  • Vinesh,

    can the entry point symbol of the application code in the NOR MEM:-

    ENTRY POINT SYMBOL: "Entry" address: 08003d00

    And the length of the boot loader code defined in the NOR MEM:-

    MEMORY
    {
    NOR_MEM : org = 0x08000000 len = 0x3D00 // 0x10000 changed /* RAM */

    be same???? Can they overlap by one address location or should they be apart???
  • Hi,

    They could, you can verify this from the map files.

    Checking at the ethercat_slave example which has a NOR build mode, the init is forced by this -
    .init: { boot*(.text)} load > 0x08010010
    However, I see a difference in your command file(not sure if this will have an impact).

    Regards,
    Vinesh
  • Do I need to re-initialize GPMC controller in my application code even if my boot nd application code remain in the 16 bit AD space??

    Regards..
  • Hi Vinesh, I think you may be correct.

    I have found that on oscilloscope that my program enters the application code and exits suddenly after traversing first thirty two addresses of the NOR FLash i.e. it enters 0x08003D00 of GPMC address space and then exits after 0x08003D3F. What can be the reason for this?

    Is it that during entry the boot loader is not getting something and it exits.. Is it that some setting has to be done in bootloader before going to application code. please inform:-

    e2e.ti.com/.../427456
  • Hi,
    If the code at 0x08003D00 is executing, it means that your application has started, and it's probably the application crashing later on.

    You can easily debug this. To debug the Bootloader -
    - After flashing the bootloader, put a Hardware breakpoint at 0x08000000
    - Give a system reset, and you'll see this breakpoint hit
    - When the breakpoint is hit, give "Load symbols" and provide the bootloader .out. Now you can debug like a normal application

    The same is applicable to the application as well. You can put a breakpoint at 0x08003d00.

    Regards,
    Vinesh
  • Hi Vinesh,

    There are two things that I did, firstly I changed my application address starting from 0x8003D04 and My boot code is assigned address from 0x08000000 with a len 0x3D00. So I removed the overlap.

    Now when I did what you told, I found that break point hits 0x8003D04 but then goes to UNDEFINED ram exception 4030CE04h...

    Why is it so???
  • Hi Vinesh,

    My boot loader bl_init.asm ends in the following way:-

    ;
    ; Enter the start_boot function. The execution still happens in system mode
    ;
    LDR r10, _main ; Get the address of main
    MOV lr,pc ; Dummy return to main
    BX r10 ; Branch to main
    SUB pc, pc, #0x08 ; looping

    ; MSR cpsr_c, #MODE_SVC|I_F_BIT ; change to SVC mode
    ; BX lr

    Shall the last two lines be un-commented here. Do these lines are required before jumping into the application code? How can i disable irqs and fiqs and go into supervisor mode before exiting bootloader and starting application code. Am i wrong somewhere... I have done what you have said but I am getting undefined exception in ram exception table...

    A lot of time has gone by and I am not much accustomed to these assembly things and doing it for the first time..
  • Hi Vinesh,

    This is the warning that I get when I jump from boot loader to application file:-

    No source available for "CPUIntStatus() at E:/SDK\am335x_sysbios_ind_sdk_1.1.0.8\sdk\starterware\binary\armv7a\cgt_ccs\am335x\evmAM335x\bootloader\NOR\boot.out:{3} 0x8003d04{4}"

    I am still not able to run the application code.. regards..

  • I have solved the problem:-

    The problem is when I make the .bin file for application code, I run the following command:-

    C:\ti\am335x_sysbios_ind_sdk_1.1.0.8\sdk\tools\post_build\post_build.bat "C:\ti\ccsv6" "C:\ti\ccsv6\tools\compiler\ti-cgt-arm_5.2.2" "C:\ti\AM335X_StarterWare_02_00_01_01\binary\armv7a\cgt_ccs\am335x\beaglebone\gpio\Release" "gpioLEDBlink" "C:\ti\am335x_sysbios_ind_sdk_1.1.0.8\sdk\tools\isdk_image" "1" "2" "0x08003D00" "0x08003D00"

    This command causes to add 16 bytes extra ahead of my .out file which causes undefined exception as those bytes are not getting executed ... When I strip off the first 16 bytes of the .bin file, I find that my .out and .bin file is same and the application code runs after boot loader.

    Alternate method will be change the command fro .bin generation from .out file by changing ->
    "1" "2" "0x08003D00" "0x08003D00" to "0" "2" "0x08003D00" "0x08003D00"

    This will solve the problem...

    Thanks vinesh learned a lot about debugging from your help..
  • Hi,

    Glad that you solved this, but I'm still not convinced by the fix. If you change the params to this - "0" "2" "0x08003D00" "0x08003D00" (check the source code in tools\isdk_image), the header won't be added. There is some mismatch happening between the bootloader and application

    Regards,
    Vinesh
  • Hi Vinesh,

    My expert after viewing the .out and .bin files in dump for bootloader and the application code told me that there is a mismatch between the .out and .bin file of the application code for which we argued that it was an additional header as prescribed in the sdk manual. He told me to strip first 16bytes from the application code which when did ran smoothly.

    Now when I generated the .bin file by changing the parameter to '0' from '1', i received the same result and it ran smoothly hence i published the solutions.

    The .bin file generated by '1', causes undefined exception as i had mentioned earlier. But this gave a smooth transition from bootloader to application code.

    Regards

  • Hi,

    By giving a '0', no header will be written to the image. (Check tools\isdk_image\isdk_image.c Line 203)

    Regards,
    Vinesh