Jump to content
43oh

Problems compiling simpleavr's rtc clock and RGB led controll


Recommended Posts

Hi guys,

 

This is my firt thread here and I'm sorry to start my participation with a problem, but I really don't know what to do.

 

I'm trying to build the simpleavr's rtc clock and his RGB led control (that's on his TI LaunchBread tutorial) but I can't even compile the codes to send them to the MSP430 MCU. I'm using CCS 5.3.0 and I get a sintax error (that's the only info I can see there) on the "interrupt" funcions. They're on the end of both codes (rtc clock have 2 functions with problems and RGB led have only one) and I don't know what's wrong with it...

 

The codes are these:

 

RGB:

 

// Timer A0 interrupt service routine
interrupt(TIMERA0_VECTOR) Timer_A(void)
	{
    clicks++;
    if (clicks&0x03) {
        P1OUT = 0x00;
    }//if
    else {
        unsigned int usep = outp;
        //_________ trying to compsensate for individual color brightness
        if ((usep&0x08)&&!(ticks%3))  usep &= ~0x08;
        if ((usep&0x02)&&!(ticks%9))  usep &= ~0x02;
        if ((usep&0x01)&&!(ticks%5))  usep &= ~0x01;
        P1OUT = usep;
        ticks++;
    }//else
}

 

And rtc clock:

 

//______________________________________________________________________
interrupt(PORT1_VECTOR) PORT1_ISR(void) {
	P1IE &= ~(BIT2|BIT7);	// disable pin interrupt
	_BIC_SR_IRQ(LPM4_bits);	// wake up, got keypressed
}
//______________________________________________________________________
interrupt(TIMERA0_VECTOR) Timer_A(void) {
	ticks++;
	if (!(ticks&0x0f)) {	// around 1 sec
		stacked++;
	}//if
}


 

I hope that you guys can help me with this :oops:

 

PS: I cut the code and left only the error part. I don't see the code was so huge...

Link to post
Share on other sites

it's long code, actually u could just post where the error was.

 

so i have CCS4 and tried it. there are several issues.

 

(1) interrupt pragma

 

. the original code was almost 3 years old and compiled on a old version of mspgcc.

. u need to change the interrupt, notice below i comment out the original and use #pragma for CCS

 

//______________________________________________________________________
//interrupt(PORT1_VECTOR) PORT1_ISR(void) {
#pragma vector=PORT1_VECTOR
__interrupt void PORT1_ISR(void) {
    P1IE &= ~(BIT2|BIT7);   // disable pin interrupt
    _BIC_SR_IRQ(LPM4_bits); // wake up, got keypressed
}
//______________________________________________________________________
//interrupt(TIMERA0_VECTOR) Timer_A(void) {
#pragma vector=TIMERA0_VECTOR
__interrupt void TIMERA0_ISR(void) {
    ticks++;
    if (!(ticks&0x0f)) {    // around 1 sec
        stacked++;
    }//if
}

(2) i2c.h issues

 

. there is this brief_pause() inline function that is not being used but it's there, mspgcc will ignore it, but CCS don't like it, so u have to comment it out or remove the whole function.

 

 

//______________________________________________________________________
/*
static void __inline__ brief_pause(register uint16_t n) {
    __asm__ __volatile__ (
                "1: \n"
                " dec      %[n] \n"
                " jne      1b \n"
        : [n] "+r"(n));


}
*/

. then there is datatype not declared inside i2c_putbyte() and i2c_getbyte().

. u have to change the int8_t into uint8_t.

//___________________________________________________
uint8_t i2c_putbyte(uint8_t  {
    int8_t i;


    for (i=7;i>=0;i--) {

finally it did compiled, and we got

 

 

"../lnk_msp430g2231.cmd", line 60: error: placement fails for object ".text",
   size 0x9ea (page 0).  Available ranges:
   FLASH        size: 0x7e0        unused: 0x726        max hole: 0x726     
"../lnk_msp430g2231.cmd", line 58: error: run placement fails for object
   ".stack", size 0x32 (page 0).  Available ranges:
   RAM          size: 0x80         unused: 0x26         max hole: 0x26      
error: errors encountered during linking; "rtc-clock.out" not built


>> Compilation failure

it's about 180 bytes over.

looks like it's impossible to have this done in CCS.

 

i then tried w/ mspgcc (very recent version) and it's about 80 bytes over. i knew the new gcc generates bigger code and some older optimization won't work the same.

 

for mspgcc there should probably be ways to get around that, but for CCS it will be quite a challenge.

 

i will try some more and update this thread.

 

 

 

 

Link to post
Share on other sites

Thanks for all the help simpleavr!

 

Changed it and now I get other errors in both files (source code .c and header .h). Before the changes I only get errors on source code. Maybe it didn't even get to header file...

 

About the errors/warnings:

 

"..\i2c.h", line 50: warning #188-D: pointless comparison of unsigned integer with zero
"..\i2c.h", line 86: warning #188-D: pointless comparison of unsigned integer with zero
"../rtc-clock.c", line 178: warning #230-D: trailing comma is nonstandard
"../rtc-clock.c", line 227: warning #230-D: trailing comma is nonstandard
"../rtc-clock.c", line 282: remark #1564-D: (ULP 14.1) Array index (involving "idx") of type "int". Recommend using "unsigned int"
"../rtc-clock.c", line 300: remark #1564-D: (ULP 14.1) Array index (involving "idx") of type "int". Recommend using "unsigned int"
"../rtc-clock.c", line 353: error #20: identifier "TASSEL__SMCLK" is undefined
"../rtc-clock.c", line 590: remark #1527-D: (ULP 2.1) Detected SW delay loop using empty loop. Recommend using a timer module instead
"../rtc-clock.c", line 605: remark #1533-D: (ULP 6.1) Detected use of multiplication on a device that has no hardware multiplier
"../rtc-clock.c", line 590: remark #1527-D: (ULP 2.1) Detected SW delay loop using empty loop. Recommend using a timer module instead
"../rtc-clock.c", line 183: remark #1535-D: (ULP 8.1) variable "menu_desc" is used as a constant. Recommend declaring variable as either 'static const' or 'const'
"../rtc-clock.c", line 230: remark #1535-D: (ULP 8.1) variable "show" is used as a constant. Recommend declaring variable as either 'static const' or 'const'
"../rtc-clock.c", line 239: remark #1535-D: (ULP 8.1) variable "range" is used as a constant. Recommend declaring variable as either 'static const' or 'const'
"../rtc-clock.c", line 338: remark #1535-D: (ULP 8.1) variable "setup_addx" is used as a constant. Recommend declaring variable as either 'static const' or 'const'
"../rtc-clock.c", line 339: remark #1535-D: (ULP 8.1) variable "digit_map1" is used as a constant. Recommend declaring variable as either 'static const' or 'const'
"../rtc-clock.c", line 340: remark #1535-D: (ULP 8.1) variable "digit_map2" is used as a constant. Recommend declaring variable as either 'static const' or 'const'
1 error detected in the compilation of "../rtc-clock.c"
These are the ones I get.

 

It seems that the problems are only with identifiers and variables :s

 

 

 

EDIT:

 

the changes in "interrupt" function worked like a charm with the RGB LED program.

 

Thank you very very much simpleavr :grin:

Link to post
Share on other sites

looks like u have only one error

 

try replace

 

TASSEL__SMCLK

 

with 

 

TASSEL_2

 

the many different macros are used in CCS and mspgcc and they are not necessary compatible w/ each other.

 

that will get u going.... on to some other errors  :smile:

 

i would guess u will hit "out of space" after solving all code issues.

 

OTOH, i managed to "steal" some flash space from infomem and put some stuff there. i.e. use more than 2k flash on a msp430g2231.

 

i still yet to test the changes, need to find the "clock" (must sit in one of my drawers) and try the changes. so don't expect quick fixes. may take a few days.

Link to post
Share on other sites

Is TASSEL_2 or TASSEL_1 I need to write? TASSEL_2 is also not defined...

 

There is any other program I can use in windows to compile this similar to linux?

 

 

Don't bother with the time it takes, really. I have a lot of time to do this. Actually I'm still waiting for the display from china. I gess the post services are waiting to see this working on the MCU for me before deliver me the display :grin:

Link to post
Share on other sites

TASSEL_2 are in TI examples so i would expect them to work in CCS5.

 

check your #include <msp430?????.h> in the top part of the source.

 

may be try to replace that w/ msp430g2231.h or whatever device u are using. the header file / device chosen.

 

to do mspgcc you can try here

 

http://mspgcc.sourceforge.net/manual/c49.html

 

i had not tried it but it should be the same. i install cygwin and build mspgcc from source.

 

mspgcc is a lot leaner and (with vi) at least for me more efficient to work on smaller projects.

Link to post
Share on other sites

So that's why I didn't find it on the code (I haven't tried to compile, just tried to find the instance). I'll try that latter along with the mspgcc. Tell me just one more thing: with that mspgcc I can transfer the project to the MSP430 or I need to use another program to transfer?

 

Thank you for all :smile:

Link to post
Share on other sites

@@canibalimao

 

i had clean up the code and now placed them in github, it's easier for everybody.

unfortunately i cannot make it build under CCS, whoever interested can try.

for mspgcc i had to do a trick to "steal" flash space from information memory, so u want to make sure u use the supplied linker commands.

 

https://github.com/simpleavr/rtc-clock

 

change log...

  • clean-up
  • code exceed 2k now w/ newer mspgcc and CCS, i made the following changes
  • alter some macros for newer compilers
  • "borrow" infomem b,c,d to put some of my constants to free up code flash. be sure to include "--section-start=.infomembcd=0x01040" when linking
  • works for mspgcc as we are just over 76 bytes
  • failed for CCS as we need almost 300 bytes (infomem has only 64x3 usable bytes)
  • compiled under cygwin and ubuntu / mint
  • get this into github

 

most of my projects has a video but i did not made one for this (as this is really an extension of the 3p4w clock). and i did a short video today.

 

compare to the 3p4w clock this has the calender feature and it will show month day, day of week etc.

 

and with newer and bigger devices like g2553/g2452 etc, the same can be achieved w/o dedicated rtc chip.

 

u can also check out my updated 3p4w clock project page which now includes code for 20pin devices.

 

Edited by bluehash
Changed media tag for youtube.
Link to post
Share on other sites
  • 2 months later...

I'm sorry for bring this up from the grave and for bother you again, but I'd only received know the display (I don't know what happened in this months with post services, but the orders from China were a "bit" delayed) and I'd only started now working on the clock.

 

I don't know what's happening but even if I define a larger mcu (msp430g2452, for example) it says that the program will not fit in the available memory. And then I have another 3 errors with unresolved symbols: TA0CCR0, TA0CCTL0 and TA0CTL. I'd searched and I can't find those references on the program :S

 

 

Besides that, I'd also tried to program an msp430g2231 with the 3p4w clock and I'm geting also those same error with unresolved symbols. Are those functions related only with mspgcc? I'm having problems installing that because I can only find a setup for cygwin and I don't know how to use it on windows :(

Link to post
Share on other sites

I don't know what's happening but even if I define a larger mcu (msp430g2452, for example) it says that the program will not fit in the available memory. And then I have another 3 errors with unresolved symbols: TA0CCR0, TA0CCTL0 and TA0CTL. I'd searched and I can't find those references on the program :S

 

 

Besides that, I'd also tried to program an msp430g2231 with the 3p4w clock and I'm geting also those same error with unresolved symbols. Are those functions related only with mspgcc? I'm having problems installing that because I can only find a setup for cygwin and I don't know how to use it on windows :-(

 

I believe you are using CCS 5, the timer registers need to be more specific as there are more than one TimerA on those 20 pin devices.

 

You should change TIMERA0_VECTOR to TIMER0_A0_VECTOR to specifically tell the compiler you are using TimerA0

 

#pragma vector=TIMER0_A0_VECTOR
__interrupt void TIMER0_A0_ISR(void) {

I am sure you also had adopt the code for CCS on other areas. Which should include removing the "fixed" address of certain constants (they were used in 2K devices when I need to "borrow" some space from infomem)

 

static const uint8_t digit2ports[][3] = {
// static __attribute__ ((section (".infomembcd"))) const uint8_t digit2ports[][3] = {

Good luck w/ your project.

 

Link to post
Share on other sites

Thank you simpleavr, once again.

 

I've done the first change but I still have the problem with the lack of space and the unresolved symbols. I gess that it really should be a problem with CCS 5, because it affects both clock programs (rtc and 3p4w).

 

The second change you're mentioning, I don't need to make because the program already had the static const uint8_t digit2ports[][3] = { function written well.

 

About the lack of space problem, I'm geting also this information: it's located on lnk_msp430g2231.cmd  file. I don't need this file because I'm using #include  <msp430g2452.h> in the beggining of the rtc-clock.c file. Is there any other place where I need to change the #include?
 

Link to post
Share on other sites

If you are using CCS5, you should configure your project to "target" to whatever device, say msp430g2452, and change your include to

 

#include "msp430.h"

 

The CCS make mechanism will fill in the proper header file for you.

 

The fact that you see a lnk_msp430g2231.cmd indicates you had create the project targeting a 2231, but you also include "msp430g2452.h", this is the likely cause of the unresolved symbols (peripherals on different devices are different) and out of memory issues.

 

You should try and change your target to G2452, or start w/ a new project.

 

 

If you build using CCS, I would suggest you to use the G2452 or G2253. Even with code optimization on GCC build, I need to "borrow" some infomem to fit everything. Fitting this into a G2231/G2211 w/ CCS will be challenging.

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...