- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Since I want to extend uCOSII with a Timer library (from Labrosse's book "Embedded Systems Building Blocks"), I tick off the "Include code for OSTimeTickHook" in RTOS settings.
So far so good, the OS_TIME_TICK_HOOK_EN is set, and the OSTimeTickHook() in /components/altera_nios2/UCossii/src/os_cpu_c.c is called. However, it seems for me as a bad location to put my code, since os_cpu_c.c seems to be overwritten at design compile time(?). Also because whatever I need to put in the hook func is pretty application specific (a call to TmrSignalTmr() in this case). Is there something I miss, a better way to use OSTimeTickHook and other "hook" functions? Could I include something in my app, for example, that overrides the OSTimeTickHook() in /components/altera_nios2/UCossii/src/os_cpu_c.c ? Thank you.Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You must set OS_CPU_HOOKS_EN = 0, and then you must declare ALL the hook functions in another file. Copy the hook functions out of OS_CPU_C.C and then just change the time tick hook function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for tip, didn't get it to work though,
OSTimeTick() in /components/micrium_uc_osii/ucosii/src/os_core.c will not do the call if OS_CPU_HOOKS_EN is 0, it seems: # if OS_TIME_TICK_HOOK_EN > 0# if OS_CPU_HOOKS_EN OSTimeTickHook(); /* Call user definable hook */# endif# endif- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Guess I can comment out that inner# if in os_core.c, since it is processor independent and won't be overwritten...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to redefine OSTimeTickHook in your own code (as well, as the rest of the OSxxxHook functions)

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page