summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2013-07-07 19:57:19 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2013-07-07 19:57:19 +0200
commita8a0eb825ea7208502954865ab09e7ec8a90221c (patch)
tree632686dacbee7778b4371ce13eeda488a500c232
parentc982426fd492b8645a04698f5a2b24e242902100 (diff)
Don't build STM32-specific code for other targets.
-rw-r--r--i2c/i2c.cpp4
-rw-r--r--rcc/rcc.cpp4
-rw-r--r--startup/entry.cpp4
-rw-r--r--usart/usart.cpp4
4 files changed, 12 insertions, 4 deletions
diff --git a/i2c/i2c.cpp b/i2c/i2c.cpp
index a395b13..833844e 100644
--- a/i2c/i2c.cpp
+++ b/i2c/i2c.cpp
@@ -1,3 +1,5 @@
+#if defined(STM32F1) || defined(STM32F4)
+
#include "i2c.h"
#include <rcc/rcc.h>
@@ -143,3 +145,5 @@ void I2C_t::read_reg(uint8_t addr_, uint8_t reg_, uint8_t len, uint8_t* buf) {
Thread::yield();
}
}
+
+#endif
diff --git a/rcc/rcc.cpp b/rcc/rcc.cpp
index 7e711f9..9f10f7c 100644
--- a/rcc/rcc.cpp
+++ b/rcc/rcc.cpp
@@ -1,3 +1,5 @@
+#if defined(STM32F1) || defined(STM32F3) || defined(STM32F4)
+
#include "rcc.h"
#include "flash.h"
@@ -49,3 +51,5 @@ void rcc_init() {
#endif
}
+
+#endif
diff --git a/startup/entry.cpp b/startup/entry.cpp
index 64aac37..3ad18f2 100644
--- a/startup/entry.cpp
+++ b/startup/entry.cpp
@@ -1,5 +1,4 @@
#include <stdint.h>
-#include <rcc/rcc.h>
#include <cortex_m/fpu.h>
int main();
@@ -18,9 +17,6 @@ extern funcp_t _fini_array_start;
extern funcp_t _fini_array_end;
void __attribute__((naked)) entry() {
- // Initialize HAL.
- rcc_init();
-
// Load .data from rom image.
uint32_t* rp = &_data_rom;
uint32_t* wp = &_data_start;
diff --git a/usart/usart.cpp b/usart/usart.cpp
index 61fe393..9de49af 100644
--- a/usart/usart.cpp
+++ b/usart/usart.cpp
@@ -1,3 +1,5 @@
+#if defined(STM32F1) || defined(STM32F3) || defined(STM32F4)
+
#include "usart.h"
template<>
@@ -5,3 +7,5 @@ void interrupt<Interrupt::USART1>() {
USART1.recv();
//GPIOB.ODR ^= 1 << 1;
}
+
+#endif