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.

TMS570LS1115 boot loader + EEPROM + compiler issue

Other Parts Discussed in Thread: TMS570LS1115, HALCOGEN

Please help i have been stuck on this boot loaded / EEPROM problem for weeks now.

I am using the TMS570LS1115 and CCS tools, with XDS200 debugger.

I am using the HALCoGen FEE library to successfully create EEPROM in Bank7.

I wish to also add a bootloader so i have divided up the FLASH into 3 segments for Bootloader, Code and Downloaded Code and RAM into two segments.

Intention is to load the Flash API into RAM2.

To program FLASH i have to move Flash API's to RAM (cannot run code and FLASH from same segment). I am 'following' the sample from TI UART Bootloader.

I have linked in the "F021_API_CortexR4_BE.lib".

This is a list of my .cmd file.

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

--retain="*(.intvecs)"

/*----------------------------------------------------------------------------*/
/* Memory Map */
MEMORY
{
VECTORS (X) : origin=0x00000000 length=0x00000020
FLASHB (RX) : origin=0x00000020 length=0x0001FFE0 // 0x000FFFE0
FLASH0 (RX) : origin=0x00040000 length=0x00060000 // 128K x 3 (393,215 bytes)
FLASH1 (RX) : origin=0x000A0000 length=0x00060000 // 128K x 3 (393,215 bytes)
STACKS (RW) : origin=0x08000000 length=0x00001300 // 4,864 bytes
RAM (RW) : origin=0x08001300 length=0x0001AD00 // 109,824
RAM2 (RW) : origin=0x0801C000 length=0x00040000 // 16 kbytes
}
/*----------------------------------------------------------------------------*/
/* Section Configuration */
SECTIONS
{
.intvecs : {} > VECTORS

flashAPI :
{
--library= F021_API_CortexR4_BE.lib < FlashStateMachine.IssueFsmCommand.obj
FlashStateMachine.SetActiveBank.obj
FlashStateMachine.InitializeFlashBanks.obj
FlashStateMachine.EnableMainSectors.obj
FlashStateMachine.IssueFsmCommand.obj
FlashStateMachine.ScaleFclk.obj
Init.obj
Utilities.CalculateEcc.obj
Utilities.WaitDelay.obj
Utilities.CalculateFletcher.obj
Read.MarginByByte.obj
Read.Common.obj
Read.FlushPipeline.obj
Read.WdService.obj
Async.WithAddress.obj
Program.obj > (.text)

} load = FLASHB, run = RAM2, LOAD_START(api_load), RUN_START(api_run), SIZE(api_size)

.text : {} > FLASH1
.const : {} > FLASH1
.cinit : {} > FLASH1
.pinit : {} > FLASH1
.bss : {} > RAM
.data : {} > RAM
.sysmem : {} > RAM

FEE_TEXT_SECTION : {} > FLASHB
FEE_CONST_SECTION : {} > FLASHB
FEE_DATA_SECTION : {} > RAM
}
/*----------------------------------------------------------------------------*/

When i call TI_Fee_Init(); from main() my program crashes..debugger ends up in sys_intvecs.asm

prefetchEntry
b prefetchEntry
b _dabort
b phantomInterrupt
ldr pc,[pc,#-0x1b0]
ldr pc,[pc,#-0x1b0]

If I remove the flashAPI: {} section then i can execute TI_Fee_Init OK but now i cannot move the API from FLASH to RAM2.

When i step through TI_Fee_Init() in 'ti_fee_ini.c', line 578 is where the code crashes,

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

I am stuck. Can someone please point me in the right direction on how to solve this issue?

thank you in advance for any assistance
Rob

  • Bob,

    You need to copy the API related code to RAM2 manually before you call them. The function of copyAPI2RAM() in UART bootloader does the copy.

    Regards,

    QJ

  • Hi QJ,

    Thank you for your feedback.

    I can now access the library and program & read EEPROM by moving the API to RAM.

    I am achieving this with the code I found in one of the posts,

    void load(char *load,char *start, unsigned int size)
    { do
    {
    *start = *load;
    start++;
    load++;
    size--;
    } while (size);
    }
    Moving onto the second part of my issues, creating a boot loader/erasing/programming FLASH.

    I have downloaded and installed the sample UART Bootloader (SPI, CAN, UART).

    I have converted the project for the TMS570LS1115 and changed some definitions to reflect.

    When I compile the TMS570LS12 / UART project I get an error that "api_load", "api_runapi","_size" are not defined. I have to declare these externally for the project to compile which is of concern. Seems like there are missing files in the project. I note there are some blank directories in the decompressed download.

    Q1
    I cannot find any definition for the copyAPI2RAM() in UART bootloader project so I have used the above code to achieve this. This is of concern as the project as is cannot work. SO I must have done something wrong or there is an issue with the project build, but I can’t figure out what has gone wrong and I cannot find any reference to the copyAPIRAM function? Where is this function defined?

    Q2
    I have assembled some test bytes into FLASH at 0x0A0000 to check that the ERASE function is working OK.

    I am using the Function, Fapi_BlockErase( uint32_t Bank, uint32_t Flash_Start_Address, uint32_t Size_In_Bytes) in bl_flash.c

    And calling from

    Main
    {
    uint16 oReturnCheck;
    uint32_t Bank=0;
    uint32_t Flash_Start_Address = 0x000A0000;
    uint32_t Size_In_Bytes = 128;

    oReturnCheck = Fapi_BlockErase( Bank, Flash_Start_Address, Size_In_Bytes);
    }

    The code gets stuck on line 195 of the function…

    while(FAPI_GET_FSM_STATUS != Fapi_Status_Success);

    and fails to erase the flash.

    Could you please suggest what may be going wrong? I have had no success at programming or erasing any FLASH outside the EEPROM area.

    I know the FEE EEPROM routines are working ok so this would suggest that the F021 API is loaded OK into RAM?

    Regards
    Rob
  • Hi QJ,

    Further to my inquiry.

    I have found the copyAPI2RAM routine in sys_core.asm of the UART project.

    I was not able to this API as HALCoGen does not generate this code for the 1115.  Is the API suppose to be generated automatically ?

    Furthermore i am concerned about the code that HALCoGen is generating for the 1115.

    Even though i specifies the 1115 micro, the FLASH configuration TAB appears to be incorrect displaying more sectors than are defined in the data sheet. See attached screen grab.

    I am also concerned that HALCoGen is generating configurations for a TMS570LS12.C rather than a specific 1115 driver ? Is this correct ? i don't think the FLASH sectors are the same so it is of concern to me.

    I have noticed when i step through the Fapi_BlockErase() function in bl_flash.c, when the status = Fapi_issueAsyncCommandWithAddress(Fapi_EraseSector, eraseStartAddr); is executed on line 191 observing the flash area (target to be erased) changes some data in the view to "?? ". So something is happening but what does this mean ? No access to area ??

    When the function on line 201 (status =  Flash_Erase_Check((uint32_t)eraseStartAddr0, Size_In_Bytes);)  is stepped through the 1st access to reading the *erased* FLASH generates a Flash access ERROR.  So i am assuming that there is a configuration issue related to the type of controller and its FLASH?

    Could you please comment on my observations.  I am really stuck on this, i have spent more time on sorting the FLASH API/boot  loader  than on my application.

    regards

    Rob

  • Hi Rob,

    The function is located sys_core.asm. I didn't use the project generated from HalCoGen. "api_load", "api_runapi","_size" are defined in link cmd file:

    SECTIONS
    {
    .intvecs : {} > VECTORS
    flashAPI :
    {
    ..\Release\Fapi_UserDefinedFunctions.obj (.text)
    ..\Release\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
    }

    I tested Flash_BlockErase() from main(), it works. What is rev # of the flash API you used?

    Regards,

    QJ

  • Hi QJ

    I have tested with the latest two version of the API.

    DO you have any comments about the HalCoGen configuration and drivers concern i raised ?

    Can you send me your working project for the 1115 ? I am really stuck here.

    Rob