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.

Application Code CRC Check at Start Up and Bootloader

Part Number: TMS320F28388D


Hi all!

I am preparing the code structure for my device. My device has 2 C28 cpus and 1 arm cortex as connectivity manager. I dont know if I should care about each cpus code files but what I assume is that eventually I will have one binary or hex file for my appclication code (all 3 cpus). I can write this app code first with programmer and later update it with bootloader via modbus tcp and/or RS485.

So, I attached a diagram below about what i need.

I will have 2 app firmware which are stored in the flash in the different flash slots or segments. But lets say I might have n firmware to generallize and n flash segments.

After power-on or reset I want my cpu to run the start up code. This start up code will check which app firmware will be used and then do the crc check for this firmware. If crc is ok it will run the app if not it will run the boot loader. Boot loader is to load new app firmware to flash memory. It will load via tcp modbus and/or rs485.

What is the easiest way to do it?

Where can I start?

Which docs, app notes should I read?

At first glance i though it makes sense to create 2+n css projects. So one project for each app firmware, startup code and bootloader. Then I will add crc info to each elf file and conver them to a binary or hex file. Then I will write each file to different memory locas with flasher or programmer. Is it true approach?

Also I think there are some integrated bootloader code which is stored in the rom. Are they able to install app firmware via tcp modbus or rs485?

Any kind of help, hint and clue would be really appreciated. Thanks in advance.

cheers,

  • Hi Engineerhan, 

    Please take a look at the Technical Reference Manual (TRM) here:  https://www.ti.com/product/TMS320F28388D.  Specifically, see section 5.3 entitled Device boot modes in the TRM.  This will help you with all the available options for the boot modes.

    Please study this application note as well:  https://www.ti.com/lit/an/sprabv4e/sprabv4e.pdf

    This should provide you with the minimum tools you need to accomplish your firmware update needs. If you have additional questions, please let us know. 

    Cheers,

    Krishna

  • Hi Krishna!

    Thanks for your answer. I wll check what you suggesed than turn back to you for further questions.

    cheers,

  • Hi KRrishna again,

    I just read the serial flashing app note. However, this is not actually what I am looking for. Actually I don't need and want to copy any code into ram from flash. Lets say i have 2 app firmware and they are like big functions as app1_cpu1() and app2_cpu1().Lets say I dont use either cpu2 or the cm at the moment. Then I have startup app as function startup_func() and the boot loader app as function_bootloader_func(). They are all located in the flash and will be run from the flash. I dont think to run any program from ram at the moment. And I will have a custom bootloader.

    Now I have 4 apps so 4 functions. Before I was thinking one project for each app but i think all apps can be written in one one project. I will place each app in a specific sector in flash. Then set the reset vector address as the starup_func() address. After reset starup_func() will run and will check which app for the cpu1 will run and then will do crc check on this appx_cpu1(). If the crc ok then it will run the app otherwise it will run the bootloader_funs(). Bootloader_func() will rewrite the crc broken appx_cpu1 then reset the cpu and so on.

    Also it is not so often but startup_func() and bootloaader_func() apps can be updated by appx_func(). In any case what i need is just to program the specific flash regions to update firmware apps, startup app or bootloader app..I just want to locate them where I want in the flash and then do crc check after linking and embed the crc data in the flash where i know. 

    What is the best practice to do it? Can i do it only with one project?

    Also I will use cpu2 and cm. So i need to update the apps for this cpus as well. But technically it is nothing more than a piece of code in the flash right?

    Can i treat all app codes(cpu1, cpu2 and cm) as single binary file and check the crc for this file by starup code at the begining and run the apps for all cpus if the crc ok? Is it posible technically?

    I hope it is clear.

    cheers,

  • Hi Engineerhan, 

    Can you please clarify your question: 

         Can i treat all app codes(cpu1, cpu2 and cm) as single binary file and check the crc for this file by starup code at the begining and run the apps for all cpus       if the crc ok? Is it posible technically?

    What do you mean by a single binary file?  There are three CPUs, so there are three applications.  If you consider CPU1 as the main controller and want to embed the CPU2 and CM applications into the CPU1, then yes you can treat it as one application but you will still have to load the appropriate flash locations for the respective CPUs with their specific applications by extracting those from CPU1. 

    Let us break this down a bit, to help our understanding of your system and that will help us help you better.  Please answer the following questions:

    1. Is your development complete for all three applications for the respective CPUs (CPU1, CPU2 and CM) 

    2. Are you able to run all three applications under CCS control from their intended locations in flash.

    3. With the applications programmed in flash (using CCS), are you able to run your entire application without the debugger. 

    4. If the answer to 3 is yes, do you use flash boot mode?

    5. All of the above is done, and now you are trying to figure out how to support a production environment for future firmware upgrades.  Is this true?

    Thanks,

    Krishna

  • Hi Krishna!

    Sorry I thought all flash memories for each cpu is in one flash memory all together but it seems each flash memory for each cpu is seperated and cpu1 cannot acces to flash of the cpu2 or cm.

    I am developing code only for cpu1 at the moment but i will use cpu2 and cm later. And yes i am trying to figure out how can do firmware update for all cpus in an easy and efficient way.

  • Ok good,  you can use the method described in the application note that you have already seen.  There are other options you may consider also.

    These are just design choices you can make and you are right in thinking about them now.  One thought on the CRC check.  You can compute a CRC on a non-functional app, and in this case the CRC check will pass but the app will not work. 

    You can think about alternate methods of determining that the firmware (that may have recently been updated) is good. 

    Thanks,

    Krishna

  • Hi Engineerhan, 

    It appears that you have marked this "Resolved".  If so, I will close this post and you re-open this one or create a new post when you are further along in your development and need further assistance. 

    Regards,

    Krishna

  • Hi Krishna!

    Thanks a lot. I got it. I just want to say that app not is for serial flashing with bootloader code from ROM memory. And d it uses uart. 

    My question is that where should I start if I want to program the flash memory with custom bootloader via ethnernet modbus or rs485?

    cheers,

  • Hi Engineerhan, 

    Since you are not locked into any design yet, you are free to do what you like.  If you are using flash boot, you could create a small bootloader that comprehends your communications interface (ethernet modbus or RS485) and has the ability to communicate with a host.  Let us say this is your primary bootloader.  On power up, this bootloader can communicate with you host to see if there is a new flash update to be made.  If there is none, it can launch the previously programmed application.  If there is no previously loaded application in flash, the bootloader can just wait for the host to provide the application. 

    Please let us know if you have additional questions.

    Regards!

    Krishna

  • Hi Krishna!

    Thanks for your asnwer. You are right. I thougth the similar to what you said. But my concern is to update other cpus(cpu2 and cm). Lets say I can update the cpu1 firmware app with my custom bootloader. What should I do if i want to update the firmwares of cpu2 or cm? Can I give the control of bootloader to cpu2 or cm? Or will cpu1 manage to update cpu2 or cm firmwares? I dont know exactly but i think this serial flasher is doing that vith IPC unit. Should I use the similar way?

    cheers,