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.

MODIFYING/placing new boot code for C5510- ON CFLASH (EMIF)

Hi all, 

I am just a beginner and only have some basic knowledge of working on C5510 DSK and CCS (assembly only).

I am working on a custom board having 4 C5510 DSPs. Presently the DSPs are boooting from the Compact Flash using Parallel EMIF Boot Mode (16 bit-Boot Pins 1011). 

But I want to change the booting program to include REGISTER CONFIGURATONs for McBSP0,1 and 2 during boot time and some initial configuration as well.

The execution entry point is contained in the boot table and is programmable.

So I wanted that I load my code in a separate location and make the DSP to boot from there, so as not to disturb the original boot code.

Please tell me how to go about it sequentially and relevant documents/codes if any.

Is it better to work on the DSK first so as to be sure of the procedure. The custom ha sa different configuration.


Also I wanted to include all RTS lib/CSL/BSL or any such things in the boot pgm, so that any application assembler/C can be ported on the DSP and run after loading with all the library functions/other resources available to it

Thanks

  • You have several questions and topics here, so I will try to break them down:

    1) Register Configuration: Adding this is simple when you use the hex55 utility command line options. There are some limits on which McBSP registers you can change, particularly clock-related registers. However you should be able to quickly find out what works and what does not by altering your bootloader image.

    2) Loading "my code" as well as original boot code: How do you want to load your code? Do you want to use the bootloader or the JTAG interface? What is the purpose of leaving the original boot code undisturbed if you're not going to execute it? How do you expect that the DSP will ever have access to the original boot code?

    2a) If you want to use the bootloader to load your code and the original boot code, then you'll need to combine both images into a single boot table. The original boot code will no longer be accessible if you change the execution entry point unless your code is aware of the old entry point and manually jumps to it. There are no tools to combine multiple, independent code images into a single bootloader image. You would have to manually link your program so that none of the code segments or initialized data segments overlap, and this might not be easy if both programs will not fit into memory at the same time. If you have the source to the original boot code, then your easiest solution, by far, is to extend the original source code to include your own code additions and create a bootloader image from your expanded sources using the normal procedures.

    2b) If you want to use a JTAG interface to load your code, then you do not really need to do anything special to avoid disturbing the original boot code. The DSP has no Flash memory, so the original boot code is loaded every time the processor is reset, assuming that the GPIO pins select the CF source. You are free to overwrite the original boot code in RAM without affecting the bootloader image in CF, but sometimes you may have trouble with the original boot code launching before you can stop it with the JTAG debugger.

    All things considered, you're probably better off just making sure that you have an adequate backup of the original boot code and then just overwrite it until you've finished your development process.

    3) There are many concepts to learn as a beginner, so it might be very useful to start with the DSK first, assuming that you already have access to one (my company's budget was such that I received the DSK after my custom hardware was up and running, and yet I still learned a few things on the DSK).  After you are familiar with most of the concepts, then you can move on to your custom hardware with fewer unknowns.

    4) There is no point in including all RTS/CSL/BSL in the boot program because whenever you port a new application (ASM/C) to the DSP you will link in the needed library functions at that time. The bootloader is not a dynamic linker like a general purpose operating system loader. You must create a self-contained image for one firmware program that includes all library functions and build that into a single boot table.  There is no mechanism for combining code from multiple sources during the boot process.  Each new port that you finish will completely replace any previous bootloader image, and thus there's no point in having the RTS/CSL/BSL image maintained separately.  This will probably all become more clear once you use the Code Composer Studio linker tools and go through the process of creating a bootloader image with hex55.exe

    Overall, some of the things you're describing are either never done in practice (at least not for embedded systems), or are fairly advanced topics for a beginner. You also seem to be focused on specific technical details of a solution because you assume that they're the correct steps to take to reach your goals. However, it would be better to clarify your actual end goals before focusing too deeply on specific technical details, so that you are free to use the correct solutions instead of heading down the wrong path.

    My apologies if I've misunderstood your goals here. Perhaps what you really want to do is easier than I think, if only we can clarify what you want to end up with.

  • Hi Brian,
    Thanks for your detailed reply. I must admit that the reqiurements look a little fuzzy.
    I will first start with the basic aim of my project-

    INTRO
    -
     Iam trying to interface MSP430(overall controller of Hardware)  as SPI master and a shared McBSP for  4 TMS320VC5510 DSP slaves.
    For development purpose, I am using CCS and a JTAG connection to download code into the DSP.
    However, as an end product I would like the project to work without a CCS/JTAG connection everytime the DSP hardware is switched ON. Once MSP430 can communicate with the DSP it can then carry out the other settings. So this McbSP2 configuration is a pre-requisite at BOOTUP of DSP.

    That is why I intended to modify the boot code so that the McbSP2 of C55 is confgured in Clock Stop Mode(mandatory) for the DSP-MSP interface.

    1) Register Configuration: Adding this is simple when you use the hex55 utility command line options. There are some limits on which McBSP registers you can change, particularly clock-related registers. However you should be able to quickly find out what works and what does not by altering your bootloader image.
    --
    Can you please refer me to some documentation/thread explaining this procedure.
    How do I find which McBSP registers can't be changed. For me Clock related registers are important because I will require the CLOCK STOP mode. If it is not allowed then What?
    And how do I alter my bootloader image to find this out. 

    2) Loading "my code" as well as original boot code: How do you want to load your code? Do you want to use the bootloader or the JTAG interface? What is the purpose of leaving the original boot code undisturbed if you're not going to execute it? How do you expect that the DSP will ever have access to the original boot code?

    I wanted to preserve the original boot code so that in case my boot code does not work properly I am able to revert back.
    I want to burn my modified boot code on the Compact Flash and then alter the Boot Table to make the Bootloader boot the DSP  from there. The whole idea of developing another code and changing the BOOT Table is due to my fear that I might spoil the original code and will not be able to then retrieve it making the DSP dysfunctional. This might be a  totally misplaced thought. 

    Thats why I dont want to disturb the original boot code. Nothing else. I might be complicating things.
    But I want to know if there is a way to backup the original boot code or is it available to revert to initial state if I modify the boot code and something goes wrong. 

    2a) If you want to use the bootloader to load your code and the original boot code, then you'll need to combine both images into a single boot table. The original boot code will no longer be accessible if you change the execution entry point unless your code is aware of the old entry point and manually jumps to it. There are no tools to combine multiple, independent code images into a single bootloader image. You would have to manually link your program so that none of the code segments or initialized data segments overlap, and this might not be easy if both programs will not fit into memory at the same time. If you have the source to the original boot code, then your easiest solution, by far, is to extend the original source code to include your own code additions and create a bootloader image from your expanded sources using the normal procedures.

    I want to use the bootloader to load my modified code weighing the benefits.
    But how do I get the source for the original boot code, where to get it from? And what is the procedure to create the bootloader image with code additions.

    2b) If you want to use a JTAG interface to load your code, then you do not really need to do anything special to avoid disturbing the original boot code. The DSP has no Flash memory, so the original boot code is loaded every time the processor is reset, assuming that the GPIO pins select the CF source. You are free to overwrite the original boot code in RAM without affecting the bootloader image in CF, but sometimes you may have trouble with the original boot code launching before you can stop it with the JTAG debugger.

    I think that this is not relevant now.

    3) There are many concepts to learn as a beginner, so it might be very useful to start with the DSK first, assuming that you already have access to one (my company's budget was such that I received the DSK after my custom hardware was up and running, and yet I still learned a few things on the DSK).  After you are familiar with most of the concepts, then you can move on to your custom hardware with fewer unknowns.

    I have DSK available with me to start with. But again I would kindly request you to guide me on this.

    4) There is no point in including all RTS/CSL/BSL in the boot program because whenever you port a new application (ASM/C) to the DSP you will link in the needed library functions at that time.
    I may have asked this question out of my ignorance. I have only been exposed to pretty basic assembly programming on C55 DSK. I have not used CSL/BSL and the RTS library for any of my experiments.
    The actual aim is to make any application which is ported on to the DSP self sufficient and have access to all that is needed. I understand from your reply that these will be included at the time of porting the application. When I  port this application on to the DSP (say using JTAG) then when I assemble, buid and link the project all this will have to be taken care of. 
    Please correct me if I have misunderstood.  

    The bootloader is not a dynamic linker like a general purpose operating system loader. You must create a self-contained image for one firmware program that includes all library functions and build that into a single boot table.  There is no mechanism for combining code from multiple sources during the boot process.  Each new port that you finish will completely replace any previous bootloader image, and thus there's no point in having the RTS/CSL/BSL image maintained separately.  This will probably all become more clear once you use the Code Composer Studio linker tools and go through the process of creating a bootloader image with hex55.exe
    From what I gather from here is that I should develop one application that includes all library functions and build that into a single boot table. Subsequently if another application is to be used I change the entire bootloader pgm specific to that application.
    But instead of burning the self contained image of bootloader for every application, can I port a fresh application each time via JTAG and do whatever is reqd.

    I would like to thank you for spelling out the details and problems for me. I might have still misunderstood some things.

    Regards 

     

  • Further questions:

    A) What sort of information do you intend to pass along McBSP2 on the common link between the MSP430 and the 4 C5510 chips?

    Answers (to the best of my knowledge and experience):

    1) There is no need to configure the McBSP2 via bootloader register commands. Instead, the bootloader will execute your code which should be designed to start by configuring the McBSP2 peripheral. There are actually quite a number of settings that must be carried out by the firmware at startup, and these are handled in your firmware source. The only time the bootloader needs to alter registers is when those registers affect the loading of the boot table itself. In your case, the bootloader cannot load firmware over McBSP2 because the bootloader is limited to loading the boot table over McBSP0, thus you should not need any register initialization commands.

    As for documentation, you need to visit the C5510 chip page and download all of the appropriate documents. Once you've read those documents, follow all links within their content to other documents. I have about 36 separate documents concerning my C5506 chip, so I imagine that you might have a lot of reading ahead of you.

    2) It appears that you have some sort of original boot code on Compact Flash.  My understanding is that Compact Flash is a removable medium.  If you would like to preserve the original boot code, then I suggest that you simply unplug the CF card and set it aside.  Buy a new CF card for experimentation with your new firmware.  That should be all that is necessary to give you a fallback.  Anything beyond this is most certainly too complicated for a beginner.

    3) Your DSK should come with documentation and sample firmware source code. Apart from that it should be identical to any other C5510 board except for the external peripherals.  The advantage of the DSK is that you basically do not have to doubt the hardware.  If something doesn't work, then you can almost certainly blame it on firmware. Meanwhile, if you use your custom hardware then when something doesn't work you have no way of knowing whether it is a hardware problem or a firmware problem (unless, of course, the custom hardware has been thoroughly tested and proven).

    4) It seems apparent that you should start using Code Composer Studio along with your JTAG interface. You will be able to do quite a bit of firmware development and testing without every bothering with a bootloader. It's only after you have things working well and feel confident that you might want to create a bootloader image to save on CF for operation without CCS. When you reach that stage, you should read the appropriate documents that are found as part of the set of files concerning the C5510.

  • Hi Brian

    Thanks a ton for your help and guidance. 

    I just want to configure the McBSP2 registers in Clock Stop mode of the DSPs to establish communication between DSP and MSP430.

    You are right-

    There is no need to configure the McBSP2 via bootloader register commands. Instead, the bootloader will execute your code which should be designed to start by configuring the McBSP2 peripheral.
    I fully agree with you that this is simpler.

    However, as I was going through the schematics of my hardware I found a connection between a GPIO pin of the MSP430 and an interrupt pin of the DSP.
    So, now I think it is wiser to use this interrupt to tell the DSP to prepare itself for the SPI communication by configuring the relevant registers using an ISR already loaded into its memory.

    Also, my codes can reside on the flash from where they can be accessed and run by the DSP. Finally, as you said , the soln indeed is quite simple.

    I hope I am correct.
    I have still learnt some things from this discussion which might prove useful in the future.
    As regards to any further queries on C55 I hope I can fall back on your experience.

    Regards
    Sunil 

     

  • Even on receiving interrupt the DSP has to be able to communicate with th external memory on EMIF. THis should be pre-configured then.

    Is there a provision to have this code for initialisation of the DSP on DSP ROM itself where the bootloader resides.

    So does the soln fianlly will be to handover control from bootloader to my code which should be designed to start by configuring the McBSP2 and then other peripherals.

    Thanks

    Sunil

  • The DSP ROM is fixed. You cannot add your code to it. However, the bootloader effectively provides the same thing if you just let it do its job of loading your code into memory.

    Handing control over from bootloader to your code is automatic. As you are already aware, there is an entry point in the boot table.  This is the starting address of your code.  The bootloader will always jump immediately to your code - there is no option to leave out the entry point.  From this point on, you effectively have the same performance as if your code were in ROM, in that it will all be available.  The only difference is that your code is not truly Read Only since it is loaded into RAM, so make sure you don't have any memory-trashing bugs in your code or it might overwrite itself.

    One thing I have been assuming all along is that the C5510 can be configured to access the bootloader on CF. I assume this is how your DSK works, how your custom hardware works, and how your final solution will work. However, the bootloader can be configured to read from a variety of locations. The thing to keep in mind is that the bootloader operation is a one-time process - the DSP is reset, it jumps to the bootloader, finds the appropriate device from which to read the boot table, then commences reading the entire boot table from the memory device and interpreting the commands.

    You mention that your "codes can reside on the flash from where they can be accessed and run by the DSP."  It seems that you imply that this will be interactive or perhaps that more than one program can be accessed.  However, this is generally not true unless your firmware is way more complex.  In general, embedded systems load all of the code that will ever be needed for operations and then that's it.  Once the bootloader process reads one set of code from CF, it will copy it to DSP memory and then jump to the entry point. After that, if you somehow need more code then you have to create a system that is a lot more complex because you have to duplicate the process of the bootloader separately.  I recommend that you fit all of your needed code into a single image, place that in the bootloader, and then not try to load any further code from CF.  This will be far simpler than dynamic loading of various and assorted pieces of code.  Keep in mind that the DSP is not a general purpose computer with an operating system running multiple programs loaded from disk.  Instead, the typical scenario is an embedded and dedicated program which is loaded exactly once and which then responds to all possible inputs correctly.

    Your next message mentions external memory on EMIF and the need to pre-configure this.  Again, there is no need to pre-configure the EMIF in the bootloader unless the bootloader is reading from EMIF (in which case the configuration is restricted by the bootloader ROM).  Like before, your code will start by configuring all hardware via the CSL, including the EMIF, and this should all happen before you enable interrupts.  By the time you enable interrupts on the DSP, all pre-configured requirements should have already been handled by your code's initialization routines.

  • Hi Brian

    I think you might be able to guide me on this topic.

    I want to make my DSP C5510 boot from a Compact Flash. It is presently booting from a DOC. 

    Can a Compact Flash be used as a primary boot device?

    The link is here

    http://e2e.ti.com/support/dsp/tms320c5000_power-efficient_dsps/f/109/p/114653/506587.aspx#506587

    Looking forward for your reply

    Warm Regards

    Sunil

  • Hi Sunil,

    My hardware and firmware experience is with the C5506, which has different bootloader capabilities. I learned everything I know by reading the documentation that Texas Instruments provides. In your case, you should search the TI web site for SPRA763, which has complete documentation of the C5510A bootloader.

    I found this document number by reading SPRS076O, the main documentation for the TMS320C5510A. Other interesting documents that you should read include SPRU312, SPRU317, SPRU371, SPRU652 and SPRZ008. You really need to allocate significant time for reading these various documents because there are many specific details of each TMS320 chip. Even within the C5000 family, there are differences between individual chips. In the past, I have tried to answer questions, only to find out later that my answers were only appropriate for the C5506, not the C5509 or C5510, etc.

    Note that if the C5510 does not support Compact Flash then you might need to switch to a different C5000 DSP. There are certainly some chips in the family which can boot from CF.

    P.S. What is a DOC?