##// END OF EJS Templates
Sync
Sync

File last commit:

r78:230ad3b6f43f dev_alexis
r102:988f7eae7e79 dev_alexis
Show More
cpuinit.c
66 lines | 1.6 KiB | text/x-c | CLexer
mkspec updates
r55 #include "stm32f4xx.h"
#include <stdlib.h>
#include <stdio.h>
#include <bsp.h>
#include <stm32f4xx_rcc.h>
#include <core.h>
Changed entry point from main to libuc_main, added hello world example.
r78 extern int libuc_main();
mkspec updates
r55
Changed entry point from main to libuc_main, added hello world example.
r78 void main()
mkspec updates
r55 {
extern uint32_t currentCpuFreq;
#ifndef CPUFREQ
#define CPUFREQ (16*1000*1000)
#endif
currentCpuFreq = CPUFREQ;
enable_FPU();
RCC->CR |= (uint32_t)0x00000001;
FLASH->ACR = FLASH_ACR_ICEN |FLASH_ACR_DCEN |FLASH_ACR_LATENCY_5WS;
reset_AHB1();
reset_AHB2();
reset_APB1();
reset_APB2();
RCC->CR |= (uint32_t)0x00000001;
FLASH->ACR = FLASH_ACR_ICEN |FLASH_ACR_DCEN |FLASH_ACR_LATENCY_5WS;
RCC->CFGR = 0x00000000;
RCC->CIR = 0x00000000;
SCB->VTOR = FLASH_BASE;
RCC->APB1ENR |= RCC_APB1ENR_PWREN;
PWR->CR |= PWR_CR_PMODE;
currentCpuFreq=setCpuFreq(currentCpuFreq);
currentCpuFreq=getCpuFreq();
configureSysTick();
bsp_init();
printf("SysTick Configured to reach 100us period\n\r");
RCC_ClocksTypeDef RCC_ClocksStatus;
RCC_GetClocksFreq(&RCC_ClocksStatus);
Changed entry point from main to libuc_main, added hello world example.
r78 printf("PLL Configured got:\n\r SYS=%uHz\n\r CPU=%uHz\n\r APB1=%uHz\n\r APB2=%uHz\n\r",
(unsigned int)RCC_ClocksStatus.SYSCLK_Frequency,
(unsigned int)RCC_ClocksStatus.HCLK_Frequency,
(unsigned int)RCC_ClocksStatus.PCLK1_Frequency,
(unsigned int)RCC_ClocksStatus.PCLK2_Frequency);
mkspec updates
r55 printf("Enter Main\n\r");
Changed entry point from main to libuc_main, added hello world example.
r78 int res=libuc_main();
mkspec updates
r55 printf("\n\rprogram exited with code ");
printf("%u",res);
printf("\n\r");
while(1)
{
delay_100us(10000);
Huge cleanup, removed "out of dir building" now libuc contains qmake and...
r71 gpioset(LED2);
mkspec updates
r55 delay_100us(10000);
Huge cleanup, removed "out of dir building" now libuc contains qmake and...
r71 gpioclr(LED2);
mkspec updates
r55 }
}