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.

Compiler/TMS320F28069: TMS320F28069 : Bootloader Development

Part Number: TMS320F28069
Other Parts Discussed in Thread: CONTROLSUITE, C2000WARE

Tool/software: TI C/C++ Compiler

[Background]

I want to develop a bootloader for TMS320F28069 controller. But here, I want to download the code through UART B (as UART A - GPIO pins are already used for some other purpose and also I do not want to go for GPIO setting for boot mode selection - as those have been already in use for different purpose). 

Hence, here I am trying to update my controller's boot rom code (Select Boot Mode Function), where  with some customization like on reset controller will switch to SCI boot mode by default.

For the same I have done some modification in code shared on "Path: <controlSUITE>\libs\utilities\boot_rom\2806x\2806x_boot_rom_v1_1\source"

When I imported this code initially I found below errors.

Error 1 ---> "../source/I2C_Boot.c", line 63: fatal error: cannot open source file "Boot.h"
Error 2 ----> "../lnk/TMS320x2806x_boot_rom_lnk.cmd", line 56: error: cannot find file "Flash2806x_API_V100.lib"

To resolve this issue,

1) Included following paths in include options menu,
"${workspace_loc:/${ProjName}/F2806x_headers/include}"
"${workspace_loc:/${ProjName}/include}"

2) Copied "Flash2806x_API_V100.lib" file from below path "C:\ti\controlSUITE\libs\utilities\flash_api\2806x\v100a\lib" into the project work space location

Now I am not getting error, but following warnings are coming.

**** Build of configuration Release for project 2806x_boot_rom ****

warning: build attribute vendor section TI missing in "../Flash2806x_API_V100.lib<Flash28_ClearLoop.obj>": compatibility cannot be determined
warning: build attribute vendor section TI missing in "../Flash2806x_API_V100.lib<Flash28_ClearSector.obj>": compatibility cannot be determined

warning: build attribute vendor section TI missing in "../Flash2806x_API_V100.lib<Flash28_Compact_Pulse.obj>": compatibility cannot be determined

warning: build attribute vendor section TI missing in "../Flash2806x_API_V100.lib<Flash28_CompactSector.obj>": compatibility cannot be determined

warning: build attribute vendor section TI missing in "../Flash2806x_API_V100.lib<Flash28_Delay.obj>": compatibility cannot be determined
warning: build attribute vendor section TI missing in "../Flash2806x_API_V100.lib<Flash28_DepCompactSector.obj>": compatibility cannot be determined
warning: build attribute vendor section TI missing in "../Flash2806x_API_V100.lib<Flash28_DepRecover.obj>": compatibility cannot be determined
warning: build attribute vendor section TI missing in "../Flash2806x_API_V100.lib<Flash28_DisInt.obj>": compatibility cannot be determined
warning: build attribute vendor section TI missing in "../Flash2806x_API_V100.lib<Flash28_Erase.obj>": compatibility cannot be determined
warning: build attribute vendor section TI missing in "../Flash2806x_API_V100.lib<Flash28_Erase_Pulse.obj>": compatibility cannot be determined
warning: build attribute vendor section TI missing in "../Flash2806x_API_V100.lib<Flash28_EraseSector.obj>": compatibility cannot be determined
warning: build attribute vendor section TI missing in "../Flash2806x_API_V100.lib<Flash28_Init.obj>": compatibility cannot be determined
warning: build attribute vendor section TI missing in "../Flash2806x_API_V100.lib<Flash28_Internals.obj>": compatibility cannot be determined
warning: build attribute vendor section TI missing in "../Flash2806x_API_V100.lib<Flash28_Prog.obj>": compatibility cannot be determined
warning: build attribute vendor section TI missing in "../Flash2806x_API_V100.lib<Flash28_Prog_Pulse.obj>": compatibility cannot be determined
warning: build attribute vendor section TI missing in "../Flash2806x_API_V100.lib<Flash28_ToggleTest.obj>": compatibility cannot be determined
warning: build attribute vendor section TI missing in "../Flash2806x_API_V100.lib<Flash28_Utils.obj>": compatibility cannot be determined
warning: build attribute vendor section TI missing in "../Flash2806x_API_V100.lib<Flash28_Verify.obj>": compatibility cannot be determined
warning: build attribute vendor section TI missing in "../Flash2806x_API_V100.lib<Flash28_Version_Hex.obj>": compatibility cannot be determined
'Finished building target: TMS320x2806x_boot_rom.out' ' '
**** Build Finished ****

[Query]

1] Is my approach is correct? Can we develop the customize boot loader program so that controller on reset will directly jump to SCI mode (UART B) by default?

2] Could you please let me know about how to resolve these warnings?

3] When I tried to download the program into target hardware, I got following error.
C28xx: Loader: One or more sections of your program falls into a memory region that is not writable. These regions will not actually be written to the target. Check your linker configuration and/or memory map.
C28xx: File Loader: Verification failed: Values at address 0x3FF72C@Program do not match Please verify target memory and memory map.
C28xx: GEL: File: C:\Source Code\2806x_boot_rom\Release\TMS320x2806x_boot_rom.out: a data verification error occurred, file load failed.

4] How to program OTP memory locations - OTP_KEY and OTP_BMODE?


Requesting you to answer above queries.

  • Vishal

    The boot ROM source code is there for reference and can't actually be loaded to the device since the boot code is in ROM (one time programmable). In order to create a custom bootloader, you must put a custom kernel in flash and set flash boot as the default boot mode.

    Refer to the F28069 Flash kernel example within device support of F2806x. This is will be your best reference.

    For the OTP locations, read more on those in the TRM: http://www.ti.com/lit/spruh18

    Best regards
    Chris
  • Hi Chris,

    Thank you for your reply.

    Now I understood that we cannot modify InitBoot function of TMS320F2806x controller. [The code provided in path: <controlSUITE>\libs\utilities\boot_rom\2806x\2806x_boot_rom_v1_1 is just for developer’s reference].

    My requirement is I should be able to program application over serial port B.
    Hence, could you please let us know how can we develop a bootloader using serial port B? Requesting you to share the references for same.

    In document "SPRUH18G" page 209/1196, it is mention in last line "Jump to branch instruction in flash memory" section,
    "You are required to have previously programmed a branch instruction at location 0x3F 7FF6 that will redirect code execution to either a custom boot-loader or the application code."
    So with this reference, can we develop a custom boot-loader using serial port B? If yes, could you share us the guideline for the same.

    Best Regards,
    Vishal
  • Vishal

    Refer to this flash kernel example, it uses SCI A and can be easily adjusted to SCI B: C:\ti\c2000\C2000Ware_1_00_01_00\device_support\f2806x\examples\c28\f28069_flash_kernel

    Additionally, some further clarifications on your second point are answered here by Sal: e2e.ti.com/.../1530799

    Best regards
    Chris
  • Hi Chris,

    I read thread by Sal: e2e.ti.com/.../1530799

    I followed his last comment & modified code given in path "C:\ti\controlSUITE\device_support\f2806x\v151\F2806x_examples_ccsv5\f28069_flash_kernel"
    for boot from ROM.

    ----------------------------------------------------------------------------------------------------------------------------------------------
    Ben,

    Fulano is correct. Please see www.ti.com/lit/spruh18

    Page 206 in the Boot Rom section reads:

    Jump to branch instruction in flash memory.
    Jump to flash is the default behavior of the Get Mode boot option. Jump to flash is also available as an emulation boot option.

    In this mode, the boot ROM software configures the device for 28x operation and branches directly to location 0x3F 7FF6. This location is just before the 128-bit code security module (CSM) password locations. You are required to have previously programmed a branch instruction at location 0x3F 7FF6 that will redirect code execution to either a custom boot-loader or the application code."

    You have a couple options.

    You can return from main which should call _ExitBoot.
    You directly branch to your application start address at the end of your kernel
    You can program a branch instruction at 0x3F 7FF6 which branches to the start of your application. This will cause the C28x to execute your flash application when it boots to Flash as well. Additionally, you can do this by building and compiling application to run from Flash. The linker and compiler will write to 0x3F 7FF6 so that the C28x will boot to your application when booting to Flash.
    Hope this helps.

    sal
    ----------------------------------------------------------------------------------------------------------------------------------------------

    Following changes I did in bootloader code.
    - Modified linker file to boot from ROM.
    - Did changes to use UART B instead of UART A
    - Executed "CopyData()" function from RAM by using [#pragma CODE_SECTION(CopyData, "ramfuncs");]
    - FLASH SECTOR A is used for bootloader code
    Note: In bootloader I haven't called _InitBoot function & _ExitBoot function. As bootloader is executed from flash hence, here entry address is _c_int00

    In separate work space I created another sample application project where application code is located in FLASH SECTOR D.
    - I did required setting for the application code to get the executable hex file in -boot8, -SCI-A, *.txt format

    Now to download my application.txt file into the controller I did following steps.
    1. Downloaded Bootloader code (Release Mode) using " XDS100v2 JTAG Debug Probe (14-pin TI version)"
    2. I put the break point at last line of Uint32 SCI_Boot() function (Release Mode). That is at "return EntryAddr;" statement. To check execution flow once application file gets copied successfully.
    ------------------------------------------------------------------------------------------------
    Uint32 SCI_Boot()
    {
    Uint32 EntryAddr;

    // Asign GetWordData to the SCI-A version of the
    // function. GetOnlyWordData is a pointer to a function.
    // This version doesn't send echo back each character.
    GetOnlyWordData = SCIA_GetOnlyWordData;

    SCIA_Init();
    SCIA_AutobaudLock();
    checksum = 0;

    // If the KeyValue was invalid, abort the load
    // and return the flash entry point.
    if (SCIA_GetOnlyWordData() != 0x08AA) return FLASH_ENTRY_POINT;

    ReadReservedFn();

    EntryAddr = GetLongData();

    CopyData();

    return EntryAddr;
    }
    ------------------------------------------------------------------------------------------------

    3. Then using PC based utility sent executable application.txt file over UART B

    Here, following observation I found
    1. When I tried to write location 0x3F 7FF6 with value read from application.txt file, my code was getting terminated.
    Here I thought as location 0x3F 7FF6 already contains bootloader's starting address, so it might be the possible reason that I am not being able to write this value at this location. So to move ahead I bypassed the memory write opration at this particular address by putting the condition :
    if(BlockHeader.DestAddr != 0x003F7FF6)
    {
    status = Flash_Program((Uint16 *) BlockHeader.DestAddr, (Uint16 *)progBuf, BlockHeader.BlockSize, &FlashStatus);
    if(status != STATUS_SUCCESS)
    {
    return ;
    }

    }

    After putting above condition, my application.txt file got written into the FLASH - SECTOR D successfully apart from the address "0x003F7FF6"

    2. Now after successful execution of CopyData() function, breakpoint on "return EntryAddr" got hit. When I did step debug (F5 key) my execution flow went into "void exit(int status) function" in exit.c

    Expected behavior was application code should start running once I call "return EntryAddr" function. But unfortunately it was not happened.


    Could you please let me know where I went wrong?
    Why my application is not getting invoked after successful CopyData() application?


    Best Regards,
    Vishal
  • Vishal,

    Please keep this discussion to one thread.

    e2e.ti.com/.../2239838

    sal