Ok so basically I'm just trying to create my first RTX application. I have the RTX_Config file for my device included in the project (It's not called RTX_Config.c, its RTX_Conf_LPC21xx.c, I was wondering if that could be the problem) I have rtl.h included im my program and I have the task identified as __task, I commented out the swi handler and replaced it w/ an import, and I changed my target options. However When I cal the os_sys_init function it never calls my task. In fact it ends up in a piece of code that looks like this:
void *__user_perthread_libspace (void) { /* Provide a separate libspace for each task. */ U32 idx; idx = runtask_id (); if (idx == 0) { /* RTX not running yet. */ return (&__libspace_start); } return ((void *)&std_libspace[idx-1]); }
When this code is called it performs that runtask_id and always gets an idx of 0 evidently this means the kernel isn't running and the program will return to the beginning of main. So my question is has anyone ever encountered this problem, and does anyone know how to fix it? Just for reference here is my program it's supposed to be a simple program that just toggles the state of GPIO0:
#include <rtl.h> #include <LPC22xx.H> OS_TID task1ID; __task void task1 (void); __task void task1(void) { task1ID = os_tsk_self(); while(1) { IOPIN0 = ~IOPIN0; os_dly_wait(4); } } int main() { PINSEL0 = 0; IODIR0 = 0xFF; IOPIN0 = 0; //task1ID = os_task_create(task1, 1); os_sys_init(task1); while(1); }
If anyone could tell me what I'm doing wrong I would be ecstatic.
Well I could get my project to build before I added it but after I get an error saying:
os.axf: Error: L6218E: Undefined symbol os_task_create (referred from main.o).
I actually think i figured this one out though. I went through rtl.h looking for that define and I'm pretty sure it's just called os_tsk_create. Once I removed that a I was able to build again. However, I'm still not able to actually get the os to perform any of my tasks.
Ok i kinda already knew this but the name of that file wasn't the issue. I'm really not seeing what I'm missing here and I feel like the os should be running fine. BTW I'm debugging this in the simulator so I'm not sure if there are any problems associated w/ that. What I'm going to do is post like all of my project and ask if anyone see's anything wrong.
Here's a link to my config file: www.dropbox.com/.../RTX_Config.c
Here's a link to my main: www.dropbox.com/.../main.c
here's a link to a screencap of my target settings: www.dropbox.com/.../target options.PNG
Here's a link to my project browser: www.dropbox.com/.../project browser.PNG
PS: Sorry about all the link's but when I added the config file to the post it said my post was too long.
I solved the problem. The issue was that I didn't check the use memory layout from target dialog box under linker settings.