diff options
author | Marti Bolivar <mbolivar@leaflabs.com> | 2011-03-08 14:44:13 -0500 |
---|---|---|
committer | Marti Bolivar <mbolivar@leaflabs.com> | 2011-03-08 15:50:32 -0500 |
commit | c37972e81501b0e8024b59e98b16c27a85597492 (patch) | |
tree | bf217f10f276e18a40498f10527f4d4aec083968 /libmaple | |
parent | 8863418f0595c8dfd7d01081be941541539827bb (diff) | |
download | librambutan-c37972e81501b0e8024b59e98b16c27a85597492.tar.gz librambutan-c37972e81501b0e8024b59e98b16c27a85597492.zip |
qa-slave-shield.cpp and test-session.cpp fixes for Mini and RET6 Edition.
There's a bit of a hack on the RET6 NR_DAC_PINS: due to the fact that
PA5 is hooked up to the built-in LED and DAC channel 2, I set
NR_DAC_PINS to 0 for the STM32F103RE (in libmaple.h), so that init()
doesn't dac_init() and mess with the LED.
Not too worried about it since this is just a beta board, but we'll
need to fix this in the design for the real version.
Also, BUT should be moved, since it steals Timer 8's channel 4 CC
connection.
Diffstat (limited to 'libmaple')
-rw-r--r-- | libmaple/libmaple.h | 92 | ||||
-rw-r--r-- | libmaple/usb/usb_callbacks.c | 18 |
2 files changed, 49 insertions, 61 deletions
diff --git a/libmaple/libmaple.h b/libmaple/libmaple.h index 6b49c45..f893cff 100644 --- a/libmaple/libmaple.h +++ b/libmaple/libmaple.h @@ -42,6 +42,20 @@ #define DEBUG_LEVEL DEBUG_ALL #endif +/* Bitbanded Memory sections */ +#define BITBAND_SRAM_REF 0x20000000 +#define BITBAND_SRAM_BASE 0x22000000 +#define BITBAND_PERI_REF 0x40000000 +#define BITBAND_PERI_BASE 0x42000000 + +#define USB_CONFIG_MAX_POWER (100 >> 1) +#define RESET_DELAY (100) + +#define ERROR_USART_NUM USART2 +#define ERROR_USART_BAUD 9600 +#define ERROR_TX_PORT GPIOA_BASE +#define ERROR_TX_PIN 2 + /* MCU-specific configuration */ #if defined(MCU_STM32F103RB) /* e.g., LeafLabs Maple */ @@ -74,39 +88,21 @@ #define VCOM_ID_PRODUCT 0x0004 #define USB_DISC_BANK GPIOC_BASE #define USB_DISC_PIN 12 - #define USB_CONFIG_MAX_POWER (100 >> 1) - #define RESET_DELAY (100) /* Where to put usercode (based on space reserved for bootloader) */ #define USER_ADDR_ROM 0x08005000 #define USER_ADDR_RAM 0x20000C00 - #define STACK_TOP 0x20000800 + #define STACK_TOP 0x20000800 /* FIXME can this possibly be correct? */ - /* Debug port settings (from ASSERT) */ #define ERROR_LED_PORT GPIOB_BASE #define ERROR_LED_PIN 12 - #define ERROR_USART_NUM USART2 - #define ERROR_USART_BAUD 9600 - #define ERROR_TX_PORT GPIOA_BASE - #define ERROR_TX_PIN 2 - - /* Just in case, most boards have at least some memory */ - #ifndef RAMSIZE - # define RAMSIZE (caddr_t)0x50000 - #endif - - /* Bitbanded Memory sections */ - #define BITBAND_SRAM_REF 0x20000000 - #define BITBAND_SRAM_BASE 0x22000000 - #define BITBAND_PERI_REF 0x40000000 - #define BITBAND_PERI_BASE 0x42000000 #elif defined(MCU_STM32F103ZE) /* e.g., LeafLabs Maple Native */ #define NR_GPIO_PORTS 7 #define NR_GPIO_PINS 100 - #define NR_BKP_REGS 42 /* TODO test on Native */ + #define NR_BKP_REGS 42 #define NR_TIMERS 8 #define NR_USART 5 /* NB: 4 and 5 are UART only */ #define NR_FSMC 1 @@ -116,8 +112,6 @@ #define VCOM_ID_PRODUCT 0x0004 #define USB_DISC_BANK GPIOB_BASE #define USB_DISC_PIN 8 - #define USB_CONFIG_MAX_POWER (100 >> 1) - #define RESET_DELAY (100) #define USER_ADDR_ROM 0x08005000 #define USER_ADDR_RAM 0x20000C00 @@ -125,26 +119,13 @@ #define ERROR_LED_PORT GPIOC_BASE #define ERROR_LED_PIN 15 - #define ERROR_USART_NUM USART1 - #define ERROR_USART_BAUD 9600 - #define ERROR_TX_PORT GPIOA_BASE - #define ERROR_TX_PIN 10 - - #ifndef RAMSIZE - # define RAMSIZE (caddr_t)0x50000 - #endif - - #define BITBAND_SRAM_REF 0x20000000 - #define BITBAND_SRAM_BASE 0x22000000 - #define BITBAND_PERI_REF 0x40000000 - #define BITBAND_PERI_BASE 0x42000000 #elif defined(MCU_STM32F103CB) /* e.g., LeafLabs Maple Mini */ #define NR_GPIO_PORTS 3 #define NR_GPIO_PINS 34 - #define NR_BKP_REGS 10 /* TODO test on Mini */ + #define NR_BKP_REGS 10 #define NR_TIMERS 4 #define NR_USART 3 #define NR_FSMC 0 @@ -154,8 +135,6 @@ #define VCOM_ID_PRODUCT 0x0005 #define USB_DISC_BANK GPIOB_BASE #define USB_DISC_PIN 9 - #define USB_CONFIG_MAX_POWER (100 >> 1) - #define RESET_DELAY 100 #define USER_ADDR_ROM 0x08005000 #define USER_ADDR_RAM 0x20000C00 @@ -163,20 +142,29 @@ #define ERROR_LED_PORT GPIOB_BASE #define ERROR_LED_PIN 1 - #define ERROR_USART_NUM USART2 - #define ERROR_USART_BAUD 9600 - #define ERROR_TX_PORT GPIOA_BASE - #define ERROR_TX_PIN 2 - - #ifndef RAMSIZE - # define RAMSIZE (caddr_t)0x50000 - #endif - - /* Bitbanded Memory sections */ - #define BITBAND_SRAM_REF 0x20000000 - #define BITBAND_SRAM_BASE 0x22000000 - #define BITBAND_PERI_REF 0x40000000 - #define BITBAND_PERI_BASE 0x42000000 + +#elif defined(MCU_STM32F103RE) + /* e.g., LeafLabs Maple RET6 Edition */ + + #define NR_GPIO_PORTS 4 + #define NR_GPIO_PINS 39 + #define NR_BKP_REGS 42 + #define NR_TIMERS 8 + #define NR_USART 5 /* NB: 4 and 5 are UART only */ + #define NR_FSMC 0 + #define NR_DAC_PINS 0 /* HACK: LED hooked up to DAC2 */ + + #define VCOM_ID_VENDOR 0x1EAF + #define VCOM_ID_PRODUCT 0x0004 + #define USB_DISC_BANK GPIOC_BASE + #define USB_DISC_PIN 12 + + #define USER_ADDR_ROM 0x08005000 + #define USER_ADDR_RAM 0x20000C00 + #define STACK_TOP 0x20000800 + + #define ERROR_LED_PORT GPIOA_BASE + #define ERROR_LED_PIN 5 #else diff --git a/libmaple/usb/usb_callbacks.c b/libmaple/usb/usb_callbacks.c index ccb0fdd..375d204 100644 --- a/libmaple/usb/usb_callbacks.c +++ b/libmaple/usb/usb_callbacks.c @@ -88,19 +88,19 @@ void vcomDataRxCb(void) { } if (cmpMatch) { - asm volatile("mov r0, %[stack_top] \n\t" // Reset the stack + asm volatile("mov r0, %[stack_top] \n\t" // Reset the stack "mov sp, r0 \n\t" "mov r0, #1 \n\t" "mov r1, %[target_addr] \n\t" "mov r2, %[cpsr] \n\t" - "push {r2} \n\t" // Fake xPSR - "push {r1} \n\t" // Target address for PC - "push {r0} \n\t" // Fake LR - "push {r0} \n\t" // Fake R12 - "push {r0} \n\t" // Fake R3 - "push {r0} \n\t" // Fake R2 - "push {r0} \n\t" // Fake R1 - "push {r0} \n\t" // Fake R0 + "push {r2} \n\t" // Fake xPSR + "push {r1} \n\t" // Target address for PC + "push {r0} \n\t" // Fake LR + "push {r0} \n\t" // Fake R12 + "push {r0} \n\t" // Fake R3 + "push {r0} \n\t" // Fake R2 + "push {r0} \n\t" // Fake R1 + "push {r0} \n\t" // Fake R0 "mov lr, %[exc_return] \n\t" "bx lr" : |