// ***************** prog.c ****************************************** // SBC-DBG sample program for ARMCortex-A9. // The program demonstrates memory store in infinite loop. // // (c) OJSC ELVEES, multicore.ru // // ******************************************************************* #include "mcom_runtime/armv7support.h" #define UINT unsigned int #define CORE0_Val *((UINT volatile *)0x20000100) #define CORE1_Val *((UINT volatile *)0x20000104) #define CORE0_WholeLoopCnt *((volatile UINT*)0x20000108) #define CORE1_WholeLoopCnt *((volatile UINT*)0x2000010c) void infLoop(volatile UINT *valToWrite, volatile UINT *wholeLoopCnt ) { int counter = 0; static int maxCountVal = 0xffff; while(1) { if (counter == maxCountVal) { counter = 0; (*wholeLoopCnt)++; } *valToWrite = counter++; } } int main() { volatile UINT* pVal = 0; volatile UINT* pWholeLoopCnt = 0; if (ArmGetCpuID() == 0) { pVal = &CORE0_Val; pWholeLoopCnt = &CORE0_WholeLoopCnt; } else { pVal = &CORE1_Val; pWholeLoopCnt = &CORE1_WholeLoopCnt; } *pVal = 0; *pWholeLoopCnt = 0; infLoop(pVal, pWholeLoopCnt); return 0; }