Multi Module Board Definition Updates (#133)

This commit is contained in:
Ben Lye
2017-12-20 11:31:20 +00:00
committed by GitHub
parent 835cc3d0a2
commit b3eccf55ba
149 changed files with 2540 additions and 4467 deletions

View File

@@ -36,7 +36,7 @@
#ifndef _BOARD_GENERIC_STM32F103C_H_
#define _BOARD_GENERIC_STM32F103C_H_
#define CYCLES_PER_MICROSECOND 72
#define CYCLES_PER_MICROSECOND (F_CPU / 1000000U)
#define SYSTICK_RELOAD_VAL (F_CPU/1000) - 1 /* takes a cycle to reload */
#define BOARD_NR_USARTS 3
@@ -70,8 +70,10 @@
#define BOARD_JTDO_PIN 19
#define BOARD_NJTRST_PIN 18
#define BOARD_USB_DISC_DEV GPIOB
#define BOARD_USB_DISC_BIT 10
#define BOARD_USB_DISC_DEV NULL
#define BOARD_USB_DISC_BIT NULL
#define LED_BUILTIN PC13
// Note this needs to match with the PIN_MAP array in board.cpp
enum {

View File

@@ -17,4 +17,6 @@ static const uint8_t MOSI = BOARD_SPI1_MOSI_PIN;
static const uint8_t MISO = BOARD_SPI1_MISO_PIN;
static const uint8_t SCK = BOARD_SPI1_SCK_PIN;
#endif /* _VARIANT_ARDUINO_STM32_ */
#define LED_BUILTIN PC13
#endif /* _VARIANT_ARDUINO_STM32_ */

View File

@@ -48,7 +48,13 @@
// works for F103 performance line MCUs, which is all that LeafLabs
// currently officially supports).
#ifndef BOARD_RCC_PLLMUL
#define BOARD_RCC_PLLMUL RCC_PLLMUL_9
#if F_CPU==128000000
#define BOARD_RCC_PLLMUL RCC_PLLMUL_16
#elif F_CPU==72000000
#define BOARD_RCC_PLLMUL RCC_PLLMUL_9
#elif F_CPU==48000000
#define BOARD_RCC_PLLMUL RCC_PLLMUL_6
#endif
#endif
namespace wirish {
@@ -71,7 +77,7 @@ namespace wirish {
#if F_CPU == 72000000
rcc_set_prescaler(RCC_PRESCALER_USB, RCC_USB_SYSCLK_DIV_1_5);
#elif F_CPU == 48000000
rcc_set_prescaler(RCC_PRESCALER_USB, RCC_USB_SYSCLK_DIV_1_5);
rcc_set_prescaler(RCC_PRESCALER_USB, RCC_USB_SYSCLK_DIV_1);
#endif
}

View File

@@ -76,28 +76,28 @@ void *_sbrk(int incr) {
return ret;
}
__weak int _open(const char *path, int flags, ...) {
__weak int _open(const char *path __attribute__((unused)), int flags __attribute__((unused)), ...) {
return 1;
}
__weak int _close(int fd) {
__weak int _close(int fd __attribute__((unused))) {
return 0;
}
__weak int _fstat(int fd, struct stat *st) {
__weak int _fstat(int fd __attribute__((unused)), struct stat *st) {
st->st_mode = S_IFCHR;
return 0;
}
__weak int _isatty(int fd) {
__weak int _isatty(int fd __attribute__((unused))) {
return 1;
}
__weak int isatty(int fd) {
__weak int isatty(int fd __attribute__((unused))) {
return 1;
}
__weak int _lseek(int fd, off_t pos, int whence) {
__weak int _lseek(int fd __attribute__((unused)), off_t pos __attribute__((unused)), int whence __attribute__((unused))) {
return -1;
}
@@ -106,13 +106,13 @@ __weak unsigned char getch(void) {
}
__weak int _read(int fd, char *buf, size_t cnt) {
__weak int _read(int fd __attribute__((unused)), char *buf, size_t cnt __attribute__((unused))) {
*buf = getch();
return 1;
}
__weak void putch(unsigned char c) {
__weak void putch(unsigned char c __attribute__((unused))) {
}
__weak void cgets(char *s, int bufsize) {
@@ -155,7 +155,7 @@ __weak void cgets(char *s, int bufsize) {
return;
}
__weak int _write(int fd, const char *buf, size_t cnt) {
__weak int _write(int fd __attribute__((unused)), const char *buf, size_t cnt) {
int i;
for (i = 0; i < cnt; i++)
@@ -165,12 +165,12 @@ __weak int _write(int fd, const char *buf, size_t cnt) {
}
/* Override fgets() in newlib with a version that does line editing */
__weak char *fgets(char *s, int bufsize, void *f) {
__weak char *fgets(char *s, int bufsize, void *f __attribute__((unused))) {
cgets(s, bufsize);
return s;
}
__weak void _exit(int exitcode) {
__weak void _exit(int exitcode __attribute__((unused))) {
while (1)
;
}