stm32f107_basic: Add support for a simple stm32f107 platform
This platform is a basic waveshare stm32f107 devkit which contains a USART, USB device port, some buttons and some LEDs. Unfortunately not enough to bring up networking, but enough to test building and a simple contiki shell
This commit is contained in:
parent
5c6018f0e2
commit
222f93f023
10 changed files with 557 additions and 0 deletions
44
platform/stm32f107_basic/contiki-main.c
Normal file
44
platform/stm32f107_basic/contiki-main.c
Normal file
|
@ -0,0 +1,44 @@
|
|||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <debug-uart.h>
|
||||
#include <sys/process.h>
|
||||
#include <sys/procinit.h>
|
||||
#include <etimer.h>
|
||||
#include <sys/autostart.h>
|
||||
#include <clock.h>
|
||||
|
||||
#include <libopencm3/stm32/f1/rcc.h>
|
||||
unsigned int idle_count = 0;
|
||||
|
||||
static void
|
||||
configure_mcu_clocks(void)
|
||||
{
|
||||
rcc_clock_setup_in_hse_25mhz_out_72mhz();
|
||||
|
||||
/* GPIO Clocks */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN);
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN);
|
||||
|
||||
/* USART 1 */
|
||||
rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_USART1EN);
|
||||
}
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
configure_mcu_clocks();
|
||||
uart_init(115200);
|
||||
printf("Initialising\n");
|
||||
|
||||
clock_init();
|
||||
process_init();
|
||||
process_start(&etimer_process, NULL);
|
||||
autostart_start(autostart_processes);
|
||||
printf("Processes running\n");
|
||||
while(1) {
|
||||
do {
|
||||
} while(process_run() > 0);
|
||||
idle_count++;
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue