• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Digital Signal Processors (DSP) » C6000 Single Core DSP » C67x Single Core DSP Forum » [C6713] debugging boot-loader code, controlling where CCS3.3 starts
Share
C6000 Single Core DSP
  • Forums
  • Announcements
Options
  • Subscribe via RSS

Forums

[C6713] debugging boot-loader code, controlling where CCS3.3 starts

This question is answered
dsp_5g
Posted by dsp_5g
on Nov 19 2008 15:56 PM
Prodigy40 points

I have a custom board using C6713B, CCS3.3 and BH USB560bp, and attempting to debug bootload assembly code.  My problem is that, from the CCS IDE, since the emulator does NOT yank on the RESET line, the boot-load code does NOT get loaded down at 0x0, and I cannot walk through the boot code.  I dearly want/need to do so.  I note that when the IDE starts, it runs the GEL file code, then jumps to _c_int00, to init the C-runtime environment, and thence to my main().  Is there any way to persuade the IDE to jump to an arbitrary location, such as my boot-load code--- which, ultimately, will jump to _c_int00?  Any help (ie, other ideas) appreciated.  jim

C6713 CCS GEL
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • TimHarron
    Posted by TimHarron
    on Nov 19 2008 17:16 PM
    Verified Answer
    Verified by clam
    Genius16720 points

    Hello Jim,

    After you load CCS I strongly suggest removing the GEL file as this 'soils' the debug-from-flash experience. The GEL file will, among other things, configure some peripherals which can cause your device to behave different than it would when run on its own.

    Note that this is actually a common mistake with bootloading because the common peripherals such as EMIF and PLL are configured automatically via the GEL. If you do not include this in your application code (generally you want this inside the second-level bootloader) you may experience boot failures. For example, if the EMIF registers are all at their default values then writes to an SDRAM would fail as the default configuration is for 8-bit ASYNC memory.

    With that said, once connecting to the target through CCS the easiest way to reproduce booting from flash is to force the Program Counter (PC) to the beggining of your boot code. You can see the current value of the PC by selecting View->Registers->Core Registers, and you can modify the value by simply double clicking the field next to PC. Because the on-chip ROM from which the device boots is not directly accessible from the memory map there is no way to step through that portion; however, there are a few things you can do to get around this limitation.

    1. Put an infinite loop inside your second-level bootloader (int value = 0; while(val == 0);). Allow the device to boot before connecting through CCS and then upon connecting break the loop (force value = 1;).

    2. You can load only the second-level bootloader directly from CCS (remember to remove the GEL file) and force the PC to 0x0 which should coincide with the beginning of your second level bootloader. This would allow you to step through the code/data copies and see where the problem(s) is.  

    There's also an article on the eXpressDSP Wiki which discusses Debugging from Flash that you may find useful.

    I hope that this helps.

    -Tim

    ---------------------------------------------------------------------------------------------------------
    Please click the Verify Answer button on this post if it answers your question.
    --------------------------------------------------------------------------------------------------------- 

    C6713 CCS Flash Debug
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • dsp_5g
    Posted by dsp_5g
    on Nov 19 2008 18:14 PM
    Prodigy40 points

    Tim,  Thanks, very helpful !! ... but also spawns additional questions. 

    Specifically, your suggestion to put an infinite loop early in the bootloader, to give me time in CCS to attach to the target, begs the question...

    What is the minimum amount of initialization that MUST be accomplished in the boot-loader assembly code, after reset, before the CCS IDE/emulator can start interacting with the C6713?  I suspect at _least_ the EMIF, but what about the PLL?  Are the JTAG/emulation registers "ready to go" immediately after reset?

    What, problems, if any, would you anticipate if my minimalist 1st- and 2nd-level boot code looked like this? ... 

         1st-level:     init EMIF then jump (branch) to 2nd-level boot code

         2nd-level:    infinite while-loop, as you suggest, then init PLL, other critical HW, copy sections, etc,  branch to _c_int00 -> main()

    Any help will be appreciated.  Jim

    C6713 bootloader
    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • TimHarron
    Posted by TimHarron
    on Nov 19 2008 18:25 PM
    Genius16720 points

    Well, technically the minimal initialization that MUST take place is 0. :-) But this would only happen if your code and data are stored inside internal memory and you do not care how slow the device runs.

    From a realistic standpoint, the EMIF initialization is probably the only thing you must take care of. The PLL, while beneficial, is not always a requirement. There aren't really any emulation registers you need to worry about, and unless you experience the problem discussed in the "CCS Crashing when Connecting" portion of the article I linked in my last post you should not run into emulation issues.

    dsp_5g
    What, problems, if any, would you anticipate if my minimalist 1st- and 2nd-level boot code looked like this? ...  
         1st-level:     init EMIF then jump (branch) to 2nd-level boot code
         2nd-level:    infinite while-loop, as you suggest, then init PLL, other critical HW, copy sections, etc,  branch to _c_int00 -> main()


    Hopefully you should experience 0 problems with the 1st-level boot. This is actually the bootloader located inside the mystery ROM on the device. This is what executes every time the device comes out of RESET and branches to the user's second-level boot code.

    The second-level boot code should initialize the EMIF, PLL, and any other absolutely required peripherals before copying the other data/code sections, and at the end branch to c_int00. At this point your code should run just like it does when loaded through CCS.

    -Tim

    ---------------------------------------------------------------------------------------------------------
    Please click the Verify Answer button on this post if it answers your question.
    --------------------------------------------------------------------------------------------------------- 

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Brad Griffis
    Posted by Brad Griffis
    on Nov 19 2008 22:39 PM
    Guru57330 points

    In your system is the EMIF clocked by SYSCLK3 or by ECLKIN?  If it's clocked by SYSCLK3 then I recommend that your bootloader first setup the PLL and then setup the EMIF.  I make this recommendation because SYSCLK3 would be affected by the PLL configuration.  All your EMIF timings will change as a result of the PLL being configured if you are using SYSCLK3 to clock the EMIF.

    To further clarify the answer to some of your earlier questions the only requirement for the emulator to connect is that the CPU is released from reset.

    I like Tim's suggestion of putting a spin loop in your bootloader.  You could do something like this:

              ZERO B1

    spin:

        [!B1] B spin

              NOP 5

    This will cause the CPU to stick in a spin loop.  Once you've connected with the emulator you can open a register window and set B1 to a non-zero value and the code will then exit the spin-loop.

    Brad

    ---------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.
    --------------------------------------------------------------------------------------------------------- 

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use