Hi there,
i wonder if there is such a thing like a Hook for own code in chSysInit() or a flag which indicates that ChibiOS is up and ready to provide all system-functions.
Background of this question is that i'm using ChibiOS in conjunction with C++ and TLSF. Thread-safe allocations are implemented with mutexes. But the "operator new()"-content has to know whether or not chibi is up and running and therefore the mutex-functions are functional, because allocations can also happen before the OS has startet (for example in static constructors ). It would be very nice if the system could provide some kind of information about the status of Chibi's initialisation status.
Thanks
chSysInit-Hook and/or chSysInit-Flag
- Giovanni
- Site Admin
- Posts: 14704
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1146 times
- Been thanked: 960 times
Re: chSysInit-Hook and/or chSysInit-Flag
Hi,
The system is up after invoking chSysInit() so it is easy enough to set a flag just before calling chSysInit() and check the flag from code called by static initializers. You could also check the links in the structure rlist, those are guaranteed to be zero before chSysInit() and not zero after.
Giovanni
The system is up after invoking chSysInit() so it is easy enough to set a flag just before calling chSysInit() and check the flag from code called by static initializers. You could also check the links in the structure rlist, those are guaranteed to be zero before chSysInit() and not zero after.
Giovanni
Re: chSysInit-Hook and/or chSysInit-Flag
Hi Giovanny, thank you for your answer.
I know this possibility and have implemented it this way already. But there are so many nice possibilities for placing board-individual code in ChibiOS ( for example the diverse *_ERROR_HOOKs, the __early_init()-function, boardInit()-function and so on ), so i hoped to find a similar place to put own system-dependant init-code into the chSysInit()-function without touching it.Giovanni wrote:The system is up after invoking chSysInit() so it is easy enough to set a flag just before calling chSysInit() and check the flag from code called by static initializers.
I don't like working system-internal-structures directly without setters/getters, even to check values. If there is an update wich changes the layout, the check may fail.Giovanni wrote:You could also check the links in the structure rlist, those are guaranteed to be zero before chSysInit() and not zero after.
Return to “Development and Feedback”
Who is online
Users browsing this forum: No registered users and 21 guests