Jump to content
43oh

New CCS vs Energia discussion.


Recommended Posts

I was just looking through some of the base code, saw  references to gpio.h etc Then started poking about here, and found that Rick wrote a minimal gpio library of sorts.

 

I think just using main.c, and gpio.h I will end up being one happy camper.

 

EDIT, to clarify, he wrote a non Energia specific gpio library of sorts. Which apparently should be smaller, and faster.

Link to post
Share on other sites

So thanks everyone for the responses to this post.

 

I was thinking that perhaps it would be good to sticky a thread as kind of a FAQ type deal. With either links to answering threads, or just definitive / clear answers given by someone who really does know the answer. Eventually, perhaps this could be used as some sort of reference, even possibly making it into some format like PDF as kind of a users guide. *That* I think in the end could help Energia be a cut above the rest. Documentation wise.

Link to post
Share on other sites

Rick, so after looking through your code there for the example , I have a question.

 

How does F_CPU work ? Is it a constant based on the actual set processor frequency, or is this something I need to #define my self outside of the Energia framework ? I mean, since I am not using the framework.

 

Preferably, I would rather have a link to documentation describing this if it is not too much of a hassle. e.g. I would rather read / figure it out on my own, than be given the answer directly.

 

Sorry if this is a very basic question ( it does kind of seem like it is to me ) but I am swimming in documentation right now, and I have not found information on it *yet*. Still looking . . .

Link to post
Share on other sites

F_CPU is just a define constant that is added to the command line at compile time.

 

msp430-g++ -DF_CPU=16000000 ....

 

In Energia, it comes from the build.f_cpu=nnnn value in boards.txt

 

https://github.com/energia/Energia/blob/master/hardware/msp430/boards.txt

 

Explained here somewhat: http://code.google.com/p/arduino/wiki/Platforms

 

-rick

Link to post
Share on other sites

Rick,, Just a heads up.

 

I was able to get a minimal "debug" print setup working over UART.  Pretty much just using oPossum's tiny printf() code. This is of course bypassing the Energia framework.

 

Binary sketch size: 741 bytes (of a 16,384 byte maximum)

 
I can live with this easily I think. Granted, this is a TX only UART implementation. Nothing more than initialization, and putc() pointing to USA0TXBUF. Not much else going on in the code, Just a WDT interrupt, WDT configured as an interval timer to print out a message every second.
 
I am starting to like Energia more now ( technically gcc-msp430 perhaps  ). Still getting used to the gcc-msp430 way of doing things, but in reality it is not all that much different, so far.
 

 

Link to post
Share on other sites

So share some code so we can all benefit :smile:

 

-rick

Its really nothing special, but I have no problem doing that. Let me clean up the code somewhat, and I will make it happen. At the moment however, I am trying to nail down my "issue" with SPI from my other post.

 

Partial explanation:

C:\Users\SANITIZED\Documents\Pelles C Projects\Test4\main.c(7): warning #2131: Shifting an 'unsigned int' by 32 bits is undefined.

 

ah ! and interestingly, on a windows machine i get a seemingly incorrect value by shifting left. Where as if i shift right, the program just crashes *checks system for memory leaks*

 

Using gcc-msp430, the value just seems to overflow. Anyhow, too much time spent on that. I'll work on it a little at a time, until I figure something out. Which will probably just prove to me something I already know. That I am an idiot ;)

Link to post
Share on other sites

Rick, 

 

So after looking through your uart/serial debugging example on page 1, I noticed the watchdog interrupt method body.

 

__attribute__( (interrupt (WDT_VECTOR)) )

 

So would the following be valid for the USCI RX interrupt ?

 

__attribute__( (interrupt (USCIAB0RX_VECTOR)) )

 

Are all constants such has these the same between development platforms ? Any major differences I should be aware of ? 

Link to post
Share on other sites

Rick, so after lots of code writing, and experimentation. I am finding that declaring variables / fields globally instead of within various methods. That this is saving some code space on the target. Is this normal ?

 

Normally, in the PC application world, I would frown on this, since I have been taught that the least possible global variables, the better. With that said, I hope this is not swapping FLASH for RAM space.

 

Another thing I was wondering about, is how is memory handled concerning file scope(RAM wise) ?  Say I have several methods /variables / fields in file a, that perform some tasks, and then once finished never get called again. I am assuming this memory would be free'd up but . . . all methods, variables / fields are not volatile of course. 

Link to post
Share on other sites

Files are of no concern when running the binary; all variables are statically mapped into memory when they're global, even if you do not expose it to other files.

 

When you have variables inside your function, the position of these variables in RAM is relative to the stack pointer at the moment that the function is called. Global variables are statically mapped at compile time. This means that some additional temporary calculations may need to be done, which may cause a larger binary (and some longer execution time).

Link to post
Share on other sites

Thanks roadrunner. I did some reading about the CCS compiler on TI's site and it makes sense.

 

The link I found was regarding ULP advisor warnings. Which indicates avoid using globals where possible, and instead use locals. I was just looking for a way to shave some code space on the device. But . . .  yeah not worth putting that 10 bytes saved in flash into ram. In the end I am not doing too bad. Around 1.35k with a good amount of functionality written in. Which I probably can still optimize down later.

 

To be clear though, I am not using CCS, I'm using Energia as a compiler( mspgcc ) / uploader. The Energia framework bypassed.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...