EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

ISR problem in MSP430 using IAR

Started by Mike V. March 12, 2004
When my ISR looks like this, all is fine:

#pragma vector=0x00
__interrupt void basic_timer(void)
{
    LPM3_EXIT;   /* exit from low power mode 3 */
}

However, when I attempt to place ANY extra lines of code in the
basic_timer() function, then I get the following error:

"Error[e16]: Segment CODE (size: 0x1008 align: 0x1) is too long for
segment definition. At least 0x4a more bytes needed. The problem..."

How the heck do I fix this? I did a keyword search in the compiler
manual, but i couldn't find the description!
Thanks,
Mike
> When my ISR looks like this, all is fine: > > #pragma vector=0x00 > __interrupt void basic_timer(void) > { > LPM3_EXIT; /* exit from low power mode 3 */ > } > > However, when I attempt to place ANY extra lines of code in the > basic_timer() function, then I get the following error: > > "Error[e16]: Segment CODE (size: 0x1008 align: 0x1) is too long for > segment definition. At least 0x4a more bytes needed. The problem..." >
It looks like your vector is wrong. Have a look in the appropriate headerfile and use the defined vectors. For the F149 the BasictimerIrqvector is 0xFFE0 So it should look like: #include <io430x41x.h> #pragma vector=BASICTIMER_VECTOR __interrupt void basic_timer(void) { LPM3_EXIT; /* exit from low power mode 3 */ } Kind regards Holger
I put the correct vector in eventually:

 #pragma vector=BASICTIMER_VECTOR
 __interrupt void basic_timer(void)
 {
      LPM3_EXIT;   /* exit from low power mode 3 */
 }
 

That one-liner above links properly with XLINK. However, if I add more
lines to the function, then i get the Error[e16]: Segment
DATA16_Z(size:0xf2 align:0x1) is too long for segment definition. At
least 0x71 more bytes needed.

I have no idea how to fix this. I tried making a function call called
my_isr_handler(), and that be the one line "my_isr_handler();" called
in the ISR above, hoping there would be a jump to that function, yet i
still get an error.







Holger Schaefer <stuff@ingenieurdienstleistungen.de> wrote in message news:<Xns94AB57645223stuffingenieurdie@62.153.159.134>...
> > When my ISR looks like this, all is fine: > > > > #pragma vector=0x00 > > __interrupt void basic_timer(void) > > { > > LPM3_EXIT; /* exit from low power mode 3 */ > > } > > > > However, when I attempt to place ANY extra lines of code in the > > basic_timer() function, then I get the following error: > > > > "Error[e16]: Segment CODE (size: 0x1008 align: 0x1) is too long for > > segment definition. At least 0x4a more bytes needed. The problem..." > > > > It looks like your vector is wrong. Have a look in the appropriate > headerfile and use the defined vectors. > For the F149 the BasictimerIrqvector is 0xFFE0 > So it should look like: > > > #include <io430x41x.h> > > #pragma vector=BASICTIMER_VECTOR > __interrupt void basic_timer(void) > { > LPM3_EXIT; /* exit from low power mode 3 */ > } > > > Kind regards > Holger
> It looks like your vector is wrong. Have a look in the appropriate > headerfile and use the defined vectors. > For the F149 the BasictimerIrqvector is 0xFFE0 > So it should look like: > > > #include <io430x41x.h> > > #pragma vector=BASICTIMER_VECTOR > __interrupt void basic_timer(void) > { > LPM3_EXIT; /* exit from low power mode 3 */ > } > >
Actually, I realized that I can add more lines to my isr. I found that the problem is that in the ISR, I access and change members of an array of structs. I guess I am violating some fundamental rule of MSP430 RAM allocation. But I still don't know how to correct it. Any hints?
>Actually, I realized that I can add more lines to my isr. I found that >the problem is that in the ISR, I access and change members of an >array of structs. I guess I am violating some fundamental rule of >MSP430 RAM allocation. But I still don't know how to correct it. Any >hints?
It might be easier to give hints if people can se what you are doing. Try posting your code.
garykato@aol.com (Gary Kato) wrote in message news:<20040315122654.06566.00001408@mb-m25.aol.com>...
> >Actually, I realized that I can add more lines to my isr. I found that > >the problem is that in the ISR, I access and change members of an > >array of structs. I guess I am violating some fundamental rule of > >MSP430 RAM allocation. But I still don't know how to correct it. Any > >hints? > > It might be easier to give hints if people can se what you are doing. Try > posting your code.
I just found out that I was using the default processor in the compiler, which allows much less RAM than I thought. What I did get out of my correspondence with IAR though is that printf() uses a lot of CSTACK size. For my MSP430F412 that i'm using, i can have 128 bytes of global RAM, the other is used for auto variables and stack. The code is rather simple, and useless to post now that I was doing something wrong the whole time. When i get to work tomorrow, i'll look at another workaround that was proposed to me to manually increase stack space, which i'm sure many of you already know how.

The 2024 Embedded Online Conference