GoodFET is booting on STM32.
authortravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Sun, 6 May 2012 13:52:46 +0000 (13:52 +0000)
committertravisutk <travisutk@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Sun, 6 May 2012 13:52:46 +0000 (13:52 +0000)
USB comms are next.

git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@1159 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

firmware/lib/stm32f407.c

index 10ec8f4..23425ef 100644 (file)
@@ -5,6 +5,39 @@
 
 #include "platform.h"
 
+#include "stm32f4xx.h"
+//#include "stm322xg_eval.h"
+#include <stm32f4xx_gpio.h>
+#include <stm32f4xx_rcc.h>
+#include <stm32f4xx_rcc.h>
+//#include "stm32f4_discovery.h"
+
+
+void ioinit(){
+  GPIO_InitTypeDef  GPIO_InitStructure;
+  
+  /* GPIOD Periph clock enable */
+  RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
+
+  /* Configure PD12, PD13, PD14 and PD15 in output pushpull mode */
+  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13| GPIO_Pin_14| GPIO_Pin_15;
+  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
+  GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
+  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
+  GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
+  GPIO_Init(GPIOD, &GPIO_InitStructure);
+}
+
+
+void ledon(){
+  //GPIOG->BSRRL=GPIO_Pin_14;
+  GPIO_ResetBits(GPIOD, GPIO_Pin_14);
+}
+void ledoff(){
+  //GPIOG->BSRRH=GPIO_Pin_14;
+  GPIO_SetBits(GPIOD, GPIO_Pin_14);
+}
+
 
 //! Count the length of a string.
 uint32_t strlen(const char *s){
@@ -13,7 +46,13 @@ uint32_t strlen(const char *s){
 
 //! Initialize the STM32F4xx ports and USB.
 void stm32f4xx_init(){
-  
+  ioinit();
+  while(1){
+    ledon();
+    delay(0x1000);
+    ledoff();
+    delay(0x1000);
+  }
 }
 
 //! Receive a byte.