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.

TMS570 Fapi_initializeFlashBanks() failure with linker for bootloader

Other Parts Discussed in Thread: HALCOGEN, TMS570LS1114, UNIFLASH, TMS570LS3137

I am using TMS570LS1114. Our application uses the flash emulated eeprom and works fine when using sys_link.cmd generated from Halcogen. When using an app_link.cmd (see below) to move things to 0x20000 for bootloader loading purposes, my code does not work. For libraries I'm using rts7R4_T_be_v3D16_eabi.lib and F021_API_CortexR4_BE_V3D16.lib version 02.01.01. In stepping thru TI_Fee_Init(), when trying to execute 

if((Fapi_initializeFlashBanks((uint32)TI_FEE_OPERATING_FREQUENCY))==Fapi_Status_Success)

I get this error in red letters:

Can't find a source file at "C:Sid\work\GIT\catmcuauto-flashapi-f021-int\API\makefile/../Source/FlashStateMachine.InitializeFlashBanks.c"

????

Below is the contents of app_link.cmd:

/*----------------------------------------------------------------------------*/
/* Linker Settings */

--retain="*(.intvecs)"
-heap 0x800

/*----------------------------------------------------------------------------*/
/* Memory Map */

MEMORY
{
VECTORS (X) : origin=0x00020000 length=0x00000020
FLASH0 (RX) : origin=0x00020020 length=0x0011FFE0
STACKS (RW) : origin=0x08000000 length=0x00001500
RAM (RW) : origin=0x08001500 length=0x0001eb00

}


/*----------------------------------------------------------------------------*/
/* Section Configuration */

SECTIONS
{
.intvecs : {} palign=8 > VECTORS
.text : {} palign=8 > FLASH0
.const : {} palign=8 > FLASH0
.cinit : {} palign=8 > FLASH0
.pinit : {} palign=8 > FLASH0
.bss : {} > RAM
.data : {} > RAM
.sysmem : {} > RAM

FEE_TEXT_SECTION : {} > FLASH0
FEE_CONST_SECTION : {} > FLASH0
FEE_DATA_SECTION : {} > RAM

}

  • James,

    I moved your question to the Hercules forums. You should get an answer here.

    Thanks,

    -Clancy
  • Hi James,

    When you say "code does not work", what is the behaviour you are observing? Is TI_Fee_Init() not successful? Can you let us know values of below variables after TI_Fee_Init() is executed?

    TI_Fee_GlobalVariables.Fee_Error, TI_Fee_GlobalVariables.Fee_ModuleState, TI_Fee_GlobalVariables.Fee_u16JobResult
  • TI_Fee_Init() is not successful. It crashes and says it can't find source code at 0xb60c.

  • Hi James,

    Can you attach your project to this thread?

  • I can't. I am working on stripping down my project so maybe I could. For debugging purposes I changed my bootloader code to simply just jump to application. With that any attempts to execute TI_Fee_Init() now gets trapped in flashErrorReal in dabort.asm. Also I had to #if out an infinite for loop in sys_startup.c. Any ideas of what might be going on here?
  • one more thing - it appears to go to flashErrorReal when trying to call TI_FeeInternal_BlankCheck() in TI_FeeInternal_UpdateBlockOffsetArray(). line 1664.
  • Hi James,

    Interrupt exception vector always starts at 0x0. It cannot be at 0x00020000 (VECTORS (X) : origin=0x00020000 length=0x00000020).

    Change VECTORS (X) : origin=0x00000000 length=0x00000020. You can find additional information at e2e.ti.com/.../206272
  • I can't have the bootloader and the application both use 0x0 for interrupt vectors. I have been following the app note for the UART bootloader and that app note has the application interupt vectors at 0x20000. My bootloader uses the sys_intvecs.asm written by QJ Wang. Contents are below. The problem is the flash emulated eeprom code that Halcogen generates just does not like this - the whole reason I have posted to this forum. If I comment out are code that uses FEE, it operates fine. I am at the mercy of TI to help on this or our product ships without a bootloader, which will make our field techs very unhappy not to mention management.

    ;-------------------------------------------------------------------------------
    ; sys_intvecs.asm
    ; Author : QJ Wang. qjwang@ti.com
    ; Date : 9-19-2012
    ;
    ; Copyright (c) 2008-2011 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.
    ;
    ;*****************************************************************************
    .sect ".intvecs"


    ;-------------------------------------------------------------------------------
    ; import reference for interrupt routines

    .ref _c_int00

    ;-------------------------------------------------------------------------------
    ; interrupt vectors
    ; Please change the #0x???? for your specified image location defined in bl_config.h

    b _c_int00 ;0x00
    b #0x1FFF8 ;0x04
    b #0x1FFF8 ;0x08, Software interrupt
    b #0x1FFF8 ;0x0C, Abort (prefetch)
    b #0x1FFF8 ;0x10, Abort (data)
    reservedEntry
    b reservedEntry ;0x14
    ldr pc,[pc, #-0x1b0] ;0x18
    ldr pc,[pc, #-0x1b0] ;0x1C

  • This is an attempt to attach zipped up project. If successful contains a project with my Halcogen files used in my project with the main() simply performing a FEE init routine. This program will fail in TI_Fee_Init() to flashErrorReal in dabort.asm. Also included is Bootloader.out which will have to be programmed on first. Bootloader fills interrupt vectors as described in sysvecs.asm by QJ Wang posted eariler and the main func simply jumps to app at 0x20000. 

    6114.workspace.zip

  • Hi James,

    I have forwarded your query to bootloader expert.
  • Ok. hopefully he can tell me how to get TI_Fee_Init() to work with an app linker at 0x20000. 

  • Vishwanath Reddy,

    I didn't get any response from QJ on this thread. I posted a new thread and did get a response - he said if there is no bootloader you will get error. I responded that I do, that the bootloader uses the sys_intvecs.asm file he wrote for bootloader so all of the exceptions are properly routed to application. No response since. 

    Is there any chance you can look at the project I posted? It contains a Bootloader.out file that you will need to program in first using Uniflash. Then load my project using code composer. If you look at the disassembly at 0x0-0x1c you will see bootloader code routes things are to application:

    00000000: EA000171 b #0x5cc

    00000004: EA007FFE b undefEntry
    00000008: EA007FFE b svcEntry
    0000000c: EA007FFE b prefetchEntry
    00000010: EA007FFE b #0x20010
    00000014: EAFFFFFE b #0x14
    00000018: E51FF1B0 ldr pc, [pc, #-0x1b0]
    0000001c: E51FF1B0 ldr pc, [pc, #-0x1b0]

    All code is in BSP folder; F021 code has its folder inside and Halcogen code has its own folder inside. The main() funciton in sys_main.c simply has this code:

    TI_Fee_Init();
    do
    {
    TI_Fee_MainFunction ();
    fee_delay ();
    sts = TI_Fee_GetStatus (0);
    }
    while(sts != IDLE);

    TI_Fee_Init() fails: goes to flashErrorReal. 

    Note: Only FEE code fails with this setup. Put any other code besides FEE code and it executes fine. If I comment out FEE code in our system code it operates normally. I created this project with FEE only code so hopefully I can get some answers to how to get the FEE code to work. 

  • James,

    Can you check if your project  allows below?

    The F021 Flash API library must be able to read from addresses 0x000, 0x100, 0x200, 0x300, and the TI OTP region, 0xF008_0000 - 0xF00B_0000, for the API to operate correctly. (This is a note in F021 user guide)


    I  tried but ended in an abort when I tried to read from above locations.

  • How did you go about checking if the project can read those addresses? How can the project be updated to insure that these addresses can be read - linker file?
  • Hi James,

    You can following lines in your sys_main.c file, before calling TI_Fee_Init() and check if your getting an abort.

    uint32 Read;

    Read = *((volatile uint32_t *)0x000U);
    Read = *((volatile uint32_t *)0x100U);
    Read = *((volatile uint32_t *)0x200U);
    Read = *((volatile uint32_t *)0x300U);
  • I get an abort when trying to read 0x100. What's the solution?

  • I figured it out. There was no code in 0x100, 0x200, or 0x300. I changed the bl_link.cnd file to start BOOT_LOAD origin from 0x400 to 0x100. With the bootloader filling in those code spaces, TI_FEE_Init() now operates.
  • Hi James,Im using TMS570ls3137 HDK,I meet the same problem with you,have you solved it?If so please tell me the solution。Tthank you very much!

  • The solution was to change the bl_link.cmd file to set the origin of BOOT_LOAD from 0x400 to 0x100. When set at 0x400 there was no code being mapped to the 0x100, 0x200, and 0x300 memory locations which for whatever reason causes this issue. Line 8 of the bl_cmd should look something like this, change made in bold:

    BOOT_LOAD (RX) : origin=0x00000100 length=0x00001300

  • I seem to understand what cause the issue,but my bl_link.cmd is not same with yours.Could you tell me how to change my code?
    Below is the contents of my bl_link.cmd:
    --retain="*(.intvecs)"


    MEMORY
    {
    VECTORS (X) : origin=0x00000000 length=0x00000020
    FLASH_API (RX) : origin=0x00000020 length=0x000014E0
    FLASH0 (RX) : origin=0x00001500 length=0x002FEB00 //LS31x and RM48 Flash size is 0x300000
    SRAM (RW) : origin=0x08002000 length=0x0002D000
    STACK (RW) : origin=0x08000000 length=0x00002000
    }
    SECTIONS
    {
    .intvecs : {} > VECTORS
    flashAPI :
    {
    Fapi_UserDefinedFunctions.obj (.text)
    bl_flash.obj (.text)
    --library= ..\lib\F021_API_CortexR4_BE.lib (.text)
    } load = FLASH_API, run = SRAM, LOAD_START(api_load), RUN_START(api_run), SIZE(api_size)

    .text > FLASH0
    .const > FLASH0
    .cinit > FLASH0
    .pinit > FLASH0
    .data > SRAM
    .bss > SRAM
    }

  • Comparing to what I have, I have a section to assign some code objects to a BOOT_LOAD partition and you do not. I don't remember why or if it was this way when I took the bootloader code example from TI. I copied a snippet from my bl_link.cmd below to show you what I mean. If what I share doesn't help you will likely have to ask for one of the TI employees like Vishwanath Reddy to help you. Good luck!

    SECTIONS
    {
    .intvecs : {} > VECTORS

    boot_code : {..\Debug\BSP\HalCoGen\TMS570SL1114PGE\source\sys_core.obj (.text)} > BOOT_LOAD
    eabi_start : {..\Debug\BSP\HalCoGen\TMS570SL1114PGE\source\sys_startup.obj (.text)} > BOOT_LOAD

    flashAPI :