2023-02-09 04:14:39 +08:00
|
|
|
// Copyright (c) 2023 Cesanta Software Limited
|
|
|
|
// All rights reserved
|
|
|
|
//
|
|
|
|
// This file contains essentials required by the CMSIS:
|
|
|
|
// uint32_t SystemCoreClock - holds the system core clock value
|
|
|
|
// SystemInit() - initialises the system, e.g. sets up clocks
|
2023-12-18 03:37:00 +08:00
|
|
|
//
|
|
|
|
// Vendor CMSIS usually contain system_XXXX.c file with SystemInit()
|
|
|
|
// We don't use it - instead, we provide our own SystemInit().
|
2023-02-09 04:14:39 +08:00
|
|
|
|
|
|
|
#include "hal.h"
|
|
|
|
|
2023-12-18 03:37:00 +08:00
|
|
|
uint32_t SystemCoreClock; // Holds system core clock in Hz. Required by CMSIS
|
2023-02-09 04:14:39 +08:00
|
|
|
|
2023-12-18 03:37:00 +08:00
|
|
|
void SystemInit(void) { // Called automatically by startup code
|
|
|
|
clock_init(); // Core clock to 480 MHz
|
|
|
|
rng_init(); // Initialise random number generator
|
|
|
|
SystemCoreClock = CPU_FREQUENCY; // defined in hal.h
|
|
|
|
SysTick_Config(SystemCoreClock / 1000); // Sys tick every 1ms
|
2023-02-09 04:14:39 +08:00
|
|
|
}
|