Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CDC freeze when using an initialized variable
13-03-2014, 06:00 PM,
RE: CDC freeze when using an initialized variable
(13-03-2014, 03:38 PM)ajomay Wrote: Dear DJ,

unfortunally the '-O3' causes a new problem. When compiling the "P32-Interrupt-Timer1.pde" example with '-O3' there is an Linker error saying:


It is good for you to try many different things and it is how we learn new things. However, you have to do some homework, too.

Regarding the interrupt issue, I have already given the hint in the post you just quoted. There are also a few discussion threads related to the issue and solutions.

It has nothing to do with '-O*' flag but 16/32bit code generation and mixture of both. This time, I give you this much hint and you fill in the blank. Tongue

15-03-2014, 07:17 PM,
RE: CDC freeze when using an initialized variable
When compiling with __MIPS16_ENABLE__ disabled by comment and optimization -O3 , one have to omit the (nomips16) attribute. So the solution is:

#include <interrupt.c>

void ISR_wrapper_vector_4(void) __attribute__ ((section (".vector_4")));
// Put the ISR_wrapper in the good place

void ISR_wrapper_vector_4(void) { Tmr1Interrupt(); }
// ISR_wrapper will call the Tmr1Interrupt()

void Tmr1Interrupt(void) __attribute__ ((interrupt));
// Tmr1Interrupt is declared as an interrupt routine

// define here the code to execute when an interrupt occure
void Tmr1Interrupt(void)
if (IFS0bits.T1IF) // Timer Interrupt flag
TMR1=0; // reset the timer register
IFS0CLR=0x10; // Clear the timer interrupt flag



Forum Jump:

Users browsing this thread: 1 Guest(s)