Newbie question: can someone explain me where I can find these functions of systick?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Newbie question: can someone explain me where I can find these functions of systick?

296 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Jantje7600 on Sun Dec 28 10:14:39 MST 2014
I am a beginner and from what I have understand from the reading posts here on the forum I have to download LPCXpresso and LPCOpen and just learn from examples. I've downloaded both and in the LPCOpen systick example the following code is given:


-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//systick.c in the src folder
#include "board.h"
#include <stdio.h>
#define TICKRATE_HZ1 (10)/* 10 ticks per second */

void SysTick_Handler(void)
{
Board_LED_Toggle(0);
}

int main(void)
{
/* Generic Initialization */
SystemCoreClockUpdate();
Board_Init();

/* Enable and setup SysTick Timer at a periodic rate */
SysTick_Config(SystemCoreClock / TICKRATE_HZ1);

/* LEDs toggle in interrupt handlers */
while (1) {
__WFI();
}

return 0;
}

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//systick.h in the src folder

#include "board.h"

/* Set up and initialize hardware prior to call to main */
void SystemInit(void)
{
unsigned int *pSCB_VTOR = (unsigned int *) 0xE000ED08;

#if defined(__IAR_SYSTEMS_ICC__)
extern void *__vector_table;

*pSCB_VTOR = (unsigned int) &__vector_table;
#elif defined(__CODE_RED)
extern void *g_pfnVectors;

*pSCB_VTOR = (unsigned int) &g_pfnVectors;
#elif defined(__ARMCC_VERSION)
extern void *__Vectors;

*pSCB_VTOR = (unsigned int) &__Vectors;
#endif

#if defined(__FPU_PRESENT) && __FPU_PRESENT == 1
fpuInit();
#endif

#if defined(NO_BOARD_LIB)
/* Chip specific SystemInit */
Chip_SystemInit();
#else
/* Setup system clocking and muxing */
Board_SystemInit();
#endif
}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

1. "Systeminit" function is defined in systick.h, what do all of those lines EXACTLY mean in words?
2. Where can I find the code of the function "void Board_SystemInit(void)" ? And what does it EXACTLY do in words?
3. Again, where can I find the code of the function "Board_LED_Toggle(0)"

VTOR is a system control block

Pretty much all of the time I ask a question someone will refer me to another site or say have you read lpcopen or something similar. I have searched hours and hours to find someting good to start with but I can't find it (user manual is not that useful for beginners and learning from examples without useful comments is also not good for beginners). Maybe if you now a really clear written book you can recommend me?

That is why I would like an explanation please.

0 Kudos
1 Reply

188 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by 1234567890 on Sun Dec 28 13:04:50 MST 2014
1. Have a look into your favourite c-book. Most of it is for the preprocessor ('#if defined' and so on.)

2.+3. Click with the left mouse button on the function (or variable or ...) you want to trace back. Then click right mouse button and chose 'open declaration' from the menu.
0 Kudos