Skip to content

Commit

Permalink
further implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
MattiaPT committed Jul 12, 2024
1 parent 08e824f commit 75040d4
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
8 changes: 5 additions & 3 deletions fsw/freertos/src/cfe_psp_start.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "cmsis_os.h"

#include "cfe_psp.h"
#include "cfe_psp_config.h"

Expand All @@ -8,20 +10,20 @@
#define CFE_PSP_NONVOL_STARTUP_FILE (GLOBAL_CONFIGDATA.CfeConfig->NonvolStartupFile)


// TODO: Fully implement after specifying the structure of the reserved memory map
void CFE_PSP_Restart(uint32 resetType)
{
if (resetType == CFE_PSP_RST_TYPE_POWERON)
{
CFE_PSP_ReservedMemoryMap.BootPtr->bsp_reset_type = CFE_PSP_RST_TYPE_POWERON;
CFE_PSP_FlushCaches(1, ReservedMemBlock.BlockPtr, ReservedMemBlock.BlockSize);
/* TODO: reboot clear */

NVIC_SystemReset();
}
else
{
CFE_PSP_ReservedMemoryMap.BootPtr->bsp_reset_type = CFE_PSP_RST_TYPE_PROCESSOR;
CFE_PSP_FlushCaches(1, ReservedMemBlock.BlockPtr, ReservedMemBlock.BlockSize);
/* TODO: reboot normal */
/* FIXME: reboot without wiping memory */
}
}

Expand Down
18 changes: 16 additions & 2 deletions fsw/freertos/src/cfe_psp_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* limitations under the License.
************************************************************************/

#include "cmsis_os.h"

#include "target_config.h"

#define CFE_PSP_CPU_ID (GLOBAL_CONFIGDATA.CpuId)
Expand All @@ -26,9 +28,21 @@
// TODO
void CFE_PSP_FlushCaches(uint32 type, void *address, uint32 size)
{
/* flush cache of size at address */
}
if (type != 1)
{
return;
}
uint32_t startAddr = (uint32_t) address;
uint32_t endAddr = startAddr + size;

startAddr &= ~31;
endAddr = (endAddr + 31) & ~31;

SCB_CleanInvalidateDCache_by_Addr((uint32_t *)startAddr, endAddr - startAddr);

__DSB();
__ISB();
}

uint32 CFE_PSP_GetProcessorId(void)
{
Expand Down
3 changes: 2 additions & 1 deletion fsw/freertos/src/cfe_psp_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ uint32 CFE_PSP_GetTimerLow32Rollover(void)

void CFE_PSP_Get_Timebase(uint32 *Tbu, uint32 *Tbl)
{
/* TODO */
// SysTick is set up in HAL_Init
return xTaskGetTickCount;
}

0 comments on commit 75040d4

Please sign in to comment.