Porting LPC2366 to LPC1768 issues
I am trying to port some code for the LPC2366 (crossworks V1.7) to the LPC1768 (Crossworks 2.03) and am having some problems. The first problem I encountered has to do with some functions I was inlining. With these functions declared as inline in the relevent .h and .c files I get "undefined reference" errors when the linker runs. If I remove the inline attributes it all builds as normal. What might be the problem?
Next I am having problems with Semaphores. I have stripped away much of the functional code during the debugging process and got it down to this, which still causes a problem.
CTL_SEMAPHORE_t sem;
void semaphore_set(void)
{
ctl_semaphore_init(&sem,1);
if(ctl_semaphore_wait(&sem,1,ctl_get_current_time()+100)==1)
{
ctl_semaphore_signal(&sem);
}
}
int EEPROM_load_array(short int byte_count,unsigned char data_size, short int EE_address,void *dest)
{
unsigned char EE_buffer[130];
semaphore_set();
return 0;
}
From the main task,before it drops priority a call to EEPROM_load_array is made. When the call to ctl_semaphore_wait is made my program ends up at ctl_handle_error saying "Unsupported_call_from_ISR", even though this code in this section should not be in an ISR. If I call semaphore_set from anywhere not nested within EEPROM_load_array, it executes correctly. What might be the problem in this case?
The above code is essentially useless, but is does reproduce the problem. When using crossworks 1.7 I have no such issues.
Edit:
I found if I change semaphore_set as follows my program crashes and lands at the HardFault_handler
void semaphore_set(void)
{
int time;
time=ctl_get_current_time();
time+=100;
ctl_semaphore_init(&sem,1);
if(ctl_semaphore_wait(&sem,1,time)==1)
{
ctl_semaphore_signal(&sem);
}
}
Please sign in to leave a comment.
Comments
0 comments