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.

UART BOOTLOADER FOR TMS570LS3137

Other Parts Discussed in Thread: HALCOGEN, TMS570LS3137, OS3, TMS570LS0714

hi all,

           I am using TMS570Ls3137 HDK board,halcogen 4, ucos-iii.I want to dump my code through bootloader.So pls help me how to add uart bootloader code in my application.

  • Pandurang,

    Please have a look to the following document:

  • Hi Jean,
    Thanks a lot.I tried to run the code from uart bootloader you suggested but it shows error.I am trying to using uart bootloader.Pls suggest
  • Pandurang,

    It will be easier if you can provide more detail on what is not working.

    I've created 2 projects targeting TMS570LS3137. All the files are included in the zip file. 1234.Data.zip

    Unzip this file on your C: root directory.. You should see a directory named: C:\data\workspace_temp

    Start CCS and select File->Switch Workspace and specify C:\data\workspace_temp as your new workspace.

    Right click on each project in the project explorer window and select open.

    Be sure that the active configuration for both project is "Release"

    1] TMS570LS3137_Blinky_Bootloader. In this directory you have the code to blink an LED on our HDK board.

    This code has 2 build configuration:
    a] Debug. This is to debug the code. It will be flashed to 0x0000_0000 and does not need the bootloader.
    b] Release. This is the configuration to use when you want to download the code using the bootloader. In this configuration, the code is moved to address 0x0002_0000 instead of 0x0000_0000

    2] TMS570LS3137-Bootloader. In this directory you have the code for the TMS570LS3137 UART bootloader.

    The bootloader code needs access to the Flash_API library. This is by default installed when Halcogen is installed, and the default directory is:

    C:\ti\Hercules\F021 Flash API\02.01.00

    This version of the bootloader needs Flash API version 02.01.00

    Both project are using an XDS560 as JTAG pod. You will have to change that to match your JTAG debug configuration.
    Also, both project are already compiled (out files and bin file for download) I will suggest to use them as is.

    Please let me know if this is helpful.

    If you encounter problem, please be as specific as possible.

  • Hi jean,
    Thanks a lot for your suggestion.

    I tried to use your code boot_uart_TMS570LS3137.It shows following error.


    Description Resource Path Location Type
    unresolved symbol Fapi_initializeFlashBanks, first referenced in ./bl_flash.obj boot_uart_TMS570LS3137 C/C++ Problem
    #10008-D cannot find file bl_link.cmd /boot_uart_TMS570LS3137 line 17 C/C++ Problem
    unresolved symbol Fapi_enableMainBankSectors, first referenced in ./bl_flash.obj boot_uart_TMS570LS3137 C/C++ Problem
    #10008-D cannot find file bl_link.cmd /boot_uart_TMS570LS3137 line 18 C/C++ Problem
    unresolved symbol Fapi_doMarginReadByByte, first referenced in ./bl_flash.obj boot_uart_TMS570LS3137 C/C++ Problem
    #10008-D cannot find file bl_link.cmd /boot_uart_TMS570LS3137 line 20 C/C++ Problem
    unresolved symbol >>, first referenced in Compilation boot_uart_TMS570LS3137 C/C++ Problem
    #10008-D cannot find file "C:\ti\Hercules\F021 Flash boot_uart_TMS570LS3137 C/C++ Problem
    #10010 errors encountered during linking; "boot_uart_TMS570LS3137.out" not built boot_uart_TMS570LS3137 C/C++ Problem
    unresolved symbol Fapi_setActiveFlashBank, first referenced in ./bl_flash.obj boot_uart_TMS570LS3137 C/C++ Problem
    <a href="file:/c:/ti/ccsv6/tools/compiler/dmed/HTML/10234.html">#10234-D</a> unresolved symbols remain boot_uart_TMS570LS3137 C/C++ Problem
    unresolved symbol Fapi_issueAsyncCommandWithAddress, first referenced in ./bl_flash.obj boot_uart_TMS570LS3137 C/C++ Problem
    unresolved symbol Fapi_issueProgrammingCommand, first referenced in ./bl_flash.obj boot_uart_TMS570LS3137 C/C++ Problem

    Pls suggest.I am using TMS570LS3137 HDK board and ccsv6.0.1.In my actual application i am using RTOS called ucos-iii.pls suggest.
  • Apparently you are missing the Flash API library.

    If installed, it is by default in C:\ti\Hercules\F021 Flash API\02.01.00
    I
    t is usually installed with Halcogen package. Tha actual release you can download is 02.01.01 but is not compatible with the Bootloader.
    As I mentioned, Flash API 02.01.00 has to be used with bootloader. We are working on a new version of bootloader to work with 02.01.01

    The download page for Flash API is:

    I will send you as zip file the version 02.01.00

    Can you also check on your PC if it is installed and let me know the version(s) you have.

  • Hi Jean,
    I am using version 02.01.00.Also if i install 02.01.01 also it shows error.


    Thanks
    pandurang Pai
  • Pandurang,

    Can you tell me the path installation for the Flash_API.

    In the project I've sent to you, the expected path for this Flash_API library is C:\ti\Hercules\F021 Flash API\02.01.00

    If for some reason your installation is different, than the library will not be found at link time.

    Here is how to change the project in case Flash_API in your case is not installed at the default location.

    1] Right click on your project name in the project explorer window and select "Show Build Settings".
    2] Expand CCS Build->ARM Linker->File Search Path as shown below.

    If the path is incorrect, double click and edit with the correct path.

    Please have a try and let me know.

  • Hi jean

    Thanks a lot now it build with out error.
    I will load this code in the hdk board on monday since I am in home now.

    One more thing what is the difference between project in active release and active debug.

    Now from your code how to upload new code in tms570ls3137. How to send from hyperterminal.

    Also we will have of around 1 mb code size is it possible to upload from this code.

    How to merge my application with your code.


    Pls pls suggest

    Thanks
    Pandurang pai
  • Pandurang,


    This is good news.

    What you have to do is to program on your device the UART bootloader first.
    This will erase the device and program the bootloader.

    Start your Hyperterminal (you have to have the usb cable plugged between your HDK and your PC.
    Here is the configuration for Hyperterminal. In my setup I use Tera Term VT.

    The COM port will certainly be different in your case. The default baudrate has to be set as 115200 as shown in the above picture.


    The next step is to run the bootloader. It will check if there is a valid application code.
    Right now there is no application so it will be in download mode.
    You should see this on your terminal:

    Before going further, the bootloader is using YMODEM protocol to download binary code to the device:
    In Tera Term you have to go through File->Transfer->YMODEM->Send and select the file you want to download.
    In my example, it is TMS570LS3137_Blinky_Bootloader.bin from the release directory.
    As I said in a previous post, the release version is linked at address 0x0002_0000

    So to start the download, from the Hyperterminal click option 1 "Download Application Image To the Internal Flash"
    In Tera Term you have to go through File->Transfer->YMODEM->Send and select the file you want to download.
    With my demo code you have to select: TMS570LS3137_Blinky_Bootloader.bin
    In your case, you will have to select your application code.

    You should see a progress bar going on. This will confirm that download is in progress.
    Now, if you click option 3 in the Hyperterminal, the bootloader will execute your application code.
    With my demo code, you should see an LED blinking on the HDK.

    So there is nothing to merge. The bootloader is one project, your application is a different project.

    Use my demo code to understand the concept before trying to download your application.

    Good luck.

  • Hi jean

    Thanks a lot for such an nice explaination.i will try this on Monday and will let you know. Thanks once again.


    Thanks
    Pandurang pai
  • Hi jean,

                  I tried with your TMS570LS3137_blinky_bootloader program it gets work fine.But once the application is loaded and once we restart the device it doesnot shows upload,download option,we have to reput the uart bootloader.I want my application to ask every time i restart my TMS device searching for app update for some time.

    Also when i put my appliaction code it stops exactly #packets :514 and bytes transferred :525312.Is there any code limit.Pls guide

    Thanks

    Pandurang Pai

  • Pandurang,

    In my first reply, I've mentioned the following document:

    http://www.ti.com/lit/an/spna193/spna193.pdf

    I suggest you read it. There is a flow diagram that explains how the bootloader works.
    In section 7 UART Bootloader Operation it is explained that GIOA_7 is used to force a re-load. Otherwise, the control is passed to your application.

    Concerning the download of your application, it is difficult to debug this problem without your code.
    So if you can share it I can have a look. If you don't want to share it on the forum, I will give you my email address so you can share is safely.

  • Hi jean,
    Pls send your personal email-id.
  • I've send you a friend request.
    please accept it and use it to share your code with me.
  • Hi jean ,
    I have attached my code to ur email-id.
  • Pandurang,


    I was able to use your code and program it via bootloader.

    Here are what I had to change.

    1] Not sure if this is an artifact of importing your project in my environment, but the Post-Build step to generate the bin file was missing.

    Here is the full command line:

    "${CCE_INSTALL_ROOT}/utils/tiobj2bin/tiobj2bin.bat" "${BuildArtifactFileName}" "${BuildArtifactFileBaseName}.bin" "${CG_TOOL_ROOT}/bin/armofd.exe" "${CG_TOOL_ROOT}/bin/armhex.exe" "${CCE_INSTALL_ROOT}/utils/tiobj2bin/mkhex4bin.exe"

    2] This is the most important part, and in my previous reply I've mentioned it many times.
         The bootloader EXPECT your application code to be mapped at address 0x0020_0000 AND NOT 0x0000_0000
          In your case, it was 0x0000_0000.
          To be able to debug the application to be downloaded I create via CCS a debug and release version. The debug version uses a linker command file where the flash is mapped to 0x0000_0000. In this case the code can be programmed via CCS directly and there is no need to use the bootloader.

    Once the code is debugged, than I create the release version. This version uses a different linker command file where the flash is now mapped to 0x0020_0000.

    I've attached to this post the 2 linker command file for your reference. These linker command files can be copied in:
    \Micrium_TMS570LS31xHDK_OS3\Micrium\Examples\TI\TMS570LS31xHDK\BSP\CCS-HCG\source directory.

    In the previous picture, you can see that for Release Version, sys_link.cmd is excluded and sys_link_release.cmd is used.
    In the Debug Version it is the opposite. sys_link.cmd is used and sys_link_release.cmd is excluded.

    So as summary, I'm able to download your code. I'm not sure how to test what it is doing.

    Please read carefully and let me know the result.https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/312/2402.sys_5F00_link_5F00_release.cmdhttps://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/312/4011.sys_5F00_link.cmd

  • Dear jean,
    Thanks for the help.But when i did the changes mentioned y you i get following error

    Description Resource Path Location Type
    #10264 RAM sys_link_release.cmd /OS3/BSP/CCS-HCG/source line 63 C/C++ Problem
    #10263 VECTORS sys_link_release.cmd /OS3/BSP/CCS-HCG/source line 59 C/C++ Problem
    #10056 symbol "main" redefined: first defined in "./BSP/CCS-HCG/source/sys_main.obj"; redefined in "./APP/app.obj" OS3 C/C++ Problem
    #10010 errors encountered during linking; "OS3.out" not built OS3 C/C++ Problem
    #10263 FLASH1 sys_link_release.cmd /OS3/BSP/CCS-HCG/source line 61 C/C++ Problem
    #10264 FLASH0 sys_link_release.cmd /OS3/BSP/CCS-HCG/source line 60 C/C++ Problem
    #10263 FLASH0 sys_link_release.cmd /OS3/BSP/CCS-HCG/source line 60 C/C++ Problem
    #10264 VECTORS sys_link_release.cmd /OS3/BSP/CCS-HCG/source line 59 C/C++ Problem
    #10263 RAM sys_link_release.cmd /OS3/BSP/CCS-HCG/source line 63 C/C++ Problem
    #10264 STACKS sys_link_release.cmd /OS3/BSP/CCS-HCG/source line 62 C/C++ Problem
    #10263 STACKS sys_link_release.cmd /OS3/BSP/CCS-HCG/source line 62 C/C++ Problem
    #10264 FLASH1 sys_link_release.cmd /OS3/BSP/CCS-HCG/source line 61 C/C++ Problem


    Can you pls send the code build successfullly by you

    Thanks
    Pandurang Pai
  • Dear Jean,

    Now it show no error .and also it get transfer through uart bootloader.But the actual application doesnot work.

    I mean this application must blink led but it doesnot.If i compile with ACTIVE-DEBUG then application works but uart bootloader not possible to send.But if made ACTIVE RELEASE then uart bootloader works but application fails.Pls suggest

    Thanks
    Pandurang pai
  • Dear Jean,
    pls help in solving this problem.Also what is the difference between Actve debug and release.

    Thanks
    pandurang Pai
  • Pandurang,

    I will try your code once in office.
    The configuration are used to specify for a given project, different option.
    Release and Debug are just name for configuration.
    Usually, during debug phase, you want to compile your code with debug information, and no optimization, to make your code easy to debug. In opposition, when your code is ready, you want optimization and maybe no more debug info.
    This can be done via different configuration.

    Again, in this specific case, the 2 configuration are used to specify the 2 linker command files.

    I will let you know when I've tried your new project (LED Blink)
  • Pandurang,


    I was able to make your OS3 application to work with the bootloader.

    Here are the modification/reason to be done in the bootloader.

    By default, the bootloader assumes the custom application will use "IRQ Handling via VIC Controller".
    Micrium OS3 does not use this mode. The RTOS has to have full control on how to manage IRQ.

    So there are 2 fixes to be done in the bootloader project.

    1] in the file sys_invecs.asm you have to change:

            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
            b   #0x1FFF8               ;0x18  (Original code: ldr pc,[pc, #-0x1b0])
            b   #0x1FFF8               ;0x1C  (Original code: ldr pc,[pc, #-0x1b0])




    2] Also in sys_startup.c you have to comment out the following statement:

            /* Initialize System - Clock, Flash settings with Efuse self check */
            systemInit();

            /* Enable IRQ offset via Vic controller */
    //        _coreEnableIrqVicOffset_();

            /* Initialize VIM table */
            {
                uint32_t i;

    Recompile the bootloader and re-flash it.
    Than download your released OS3.bin. It will work.

    NOTE: After this modification in the bootloader, the blinky application I've send to you as example WILL NOT WORK ANYMORE.
    This demo code expect the bootloader to use "IRQ Handling via VIC Controller".

    I suggest you to read in the TRM the chapter 15 "Vector Interrupt Manager (VIM) Module"

  • Pandurang,

    If I've answer your question, could you please mark this thread as "Answered". Thank you.
  • hi jean,
    I have the same probelem,can you send me the zip file about version 02.01.00?(1649431557@qq.com)
    Another question,how to reflash the bootloader?ti's same to refalsh the application code?if so,does it means anyone can reflash bootloader?

    All the best.
  • hi Jean,

    I have same problem,can you send me Flash API/02.01.00? I counldn't find it online.

    Jer
  • Hi Jean-Marc,

    i am trying to implement a CAN Boatloader on a TMS570LS0714.

    I was trying to use the existing bootloader code but am also encountering problems as it is using the old Flash API 02.01.00 which i cannot find for download anywhere.

    Do you know if there is a newer bootloader demo project based on the current Flash API 02.01.01 available or can you provide us the old API 02.01.00 for evaluation and as starting point for adaptions?

    Any help is much appreciated, 

    Cheers