4
\$\begingroup\$

I am working with TI's CC2540 SoC using CC2540dk-mini. My software stack is:

  • Ubuntu 12.04
  • sdcc Compiler
  • cc-tool to flash programs onto board using cc-debugger

I can compile, build and flash firmwares perfectly (until now) using these tools. But I do not know how to debug (toggle breakpoints, see sfr values, etc.) or even to "print" from CC2540.

Chapter 3 from CC2540 user guide talks about the debug interface, and reading it I notice that flash programming is done using this interface. So... aparently to debug the firmware I would have to extend cc-tool. It sounds right?

About printing: reading the sdcc user guide (section 3.17.2.1) I realize that I have to provide putchar() function, which makes sense. But what low level protocol should I use? USART? Or something else? (debug interface?) How the CC2540 can talk with cc-debugger? How cc-debugger can talk with Ubuntu?

This all seems a little vague, but it is because I have no experience in this "field" (I always used Arduino and I never had to go in this "low level" before).

\$\endgroup\$
  • \$\begingroup\$ With Arduino, you are adapting a runtime communication scheme (serial over USB) to briefly talk to a bootloader on the chip. In contrast, the CC debugger talks to dedicated logic in the chip, and isn't really intended for runtime communication from a user program. There may be a specific secondary capability built into it for that. Or if not, you may be able to create a communication channel by having the debugger monitor mailbox variables for information from the program, and then set a flag to let the program know the message has been collected and can be overwritten by a new one. \$\endgroup\$ – Chris Stratton May 6 '14 at 17:21
  • \$\begingroup\$ Why not use Code composer studio?? You get a free license with you dev kit (see here processors.wiki.ti.com/index.php/Licensing_-_CCS), they have a version that runs in linux. Using the full IDE will take away the complexity of setting up your debug environment. As to putchar() the communication interface is your choice, I doubt that you can use the debbuger interface but pretty much take your pick from the available communication interfaces in you micro. \$\endgroup\$ – Kvegaoro Jun 8 '15 at 20:24
1
\$\begingroup\$

I assume you are using code composer and you should(Keil uvision is a other good option). When you must select in the Flash button's arrow the "debug" option(little insect icon).

enter image description here

Than when you are going to Flash your MCU a interface will open showing the register and where you can track variable values.

Regards, MathieuL.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.