Our project is Advanced Drive Assist Sytem (ADAS) Controller. This embedded controller is based on Renesas RH850 / U2A16 Microcontroller. Our design is based on Autosar RTOS by ETAS. Our software architecture is basically Application Software and low-level software. We are using WindRiver Diab Compiler version 5.9.6.6 to compile 'C' language code.
Application software calls low-level software API to erase data flash in non-blocking manner. Typically, the way non-blocking functionality is implemented is to create a special purpose non-blocking task in the RTOS, which has lower priority than all the other time-based rtos tasks. Non-blocking API simply writes some variables to set up a non-blocking operation, and then the operation is actually carried out in the special purpose low priority task. The only tricky thing with this design is that the application software requests non-blocking erases during the power-down procedure, after Application software have disabled all tasks and interrupts - so care must be take to ensure the special-purpose non-blocking task does NOT get disabled during controller shutdown.
Following may be some options for implementing non-blocking erase functionality:
Application software calls low-level software API to erase data flash in non-blocking manner. Typically, the way non-blocking functionality is implemented is to create a special purpose non-blocking task in the RTOS, which has lower priority than all the other time-based rtos tasks. Non-blocking API simply writes some variables to set up a non-blocking operation, and then the operation is actually carried out in the special purpose low priority task. The only tricky thing with this design is that the application software requests non-blocking erases during the power-down procedure, after Application software have disabled all tasks and interrupts - so care must be take to ensure the special-purpose non-blocking task does NOT get disabled during controller shutdown.
Following may be some options for implementing non-blocking erase functionality:
- During shutdown all tasks and interrupts will be disabled. This means from background task application software will call low-level API to erase data flash. Just FYI, RTOS autostarts background task after application software is initialized. Background task is controlled by application software. Background task never returns. The API will write few variables to setup erase operation. Can the actual erase operation functionality be in the background task? One advantage is that background task isn't disabled during shutdown. Some of the disadvantages may be when application software calls API to find out if erase has completed. The operation that checks erase complete functionality will be in the background task and it is unknown how often this operation will execute in the background task. The API that is called to get erase status and code in background task that fetches the erase status from data flash might not be synchronized.
- What might be some issues with implementing erase functionality in Interrupt Service Routine (ISR) ?
- What are other options?