From 13635d539f6f221110705de3b17bd3267cbc68e0 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Mon, 15 Apr 2013 15:01:58 -0400 Subject: usb_cdcacm: Reset transmitting flag in usbReset(). Thanks to Manuel Odenahl for the fix. Signed-off-by: Marti Bolivar --- libmaple/usb/stm32f1/usb_cdcacm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libmaple/usb/stm32f1/usb_cdcacm.c b/libmaple/usb/stm32f1/usb_cdcacm.c index dfd8d56..d4d4262 100644 --- a/libmaple/usb/stm32f1/usb_cdcacm.c +++ b/libmaple/usb/stm32f1/usb_cdcacm.c @@ -609,6 +609,7 @@ static void usbReset(void) { n_unread_bytes = 0; n_unsent_bytes = 0; rx_offset = 0; + transmitting = 0; } static RESULT usbDataSetup(uint8 request) { -- cgit v1.2.3 From 5315e3a23935c2acca70c188d6e1a9974e482770 Mon Sep 17 00:00:00 2001 From: Manuel Odendahl Date: Fri, 26 Apr 2013 11:08:59 +0200 Subject: Preserve previous usb state when suspending / restore on resume Signed-off-by: Manuel Odendahl --- libmaple/include/libmaple/usb.h | 1 + libmaple/usb/stm32f1/usb.c | 20 +++++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/libmaple/include/libmaple/usb.h b/libmaple/include/libmaple/usb.h index 2be5971..ea24030 100644 --- a/libmaple/include/libmaple/usb.h +++ b/libmaple/include/libmaple/usb.h @@ -151,6 +151,7 @@ typedef struct usblib_dev { void (**ep_int_in)(void); void (**ep_int_out)(void); usb_dev_state state; + usb_dev_state prevState; rcc_clk_id clk_id; } usblib_dev; diff --git a/libmaple/usb/stm32f1/usb.c b/libmaple/usb/stm32f1/usb.c index c20cc71..b19ce33 100644 --- a/libmaple/usb/stm32f1/usb.c +++ b/libmaple/usb/stm32f1/usb.c @@ -76,6 +76,7 @@ struct { static usblib_dev usblib = { .irq_mask = USB_ISR_MSK, .state = USB_UNCONNECTED, + .prevState = USB_UNCONNECTED, .clk_id = RCC_USB, }; usblib_dev *USBLIB = &usblib; @@ -115,6 +116,7 @@ static void usb_suspend(void) { cntr |= USB_CNTR_LP_MODE; USB_BASE->CNTR = cntr; + USBLIB->prevState = USBLIB->state; USBLIB->state = USB_SUSPENDED; } @@ -132,14 +134,15 @@ static void usb_resume_init(void) { static void usb_resume(RESUME_STATE eResumeSetVal) { uint16 cntr; - if (eResumeSetVal != RESUME_ESOF) - ResumeS.eState = eResumeSetVal; + if (eResumeSetVal != RESUME_ESOF) { + ResumeS.eState = eResumeSetVal + } - switch (ResumeS.eState) - { + switch (ResumeS.eState) { case RESUME_EXTERNAL: usb_resume_init(); ResumeS.eState = RESUME_OFF; + USBLIB->state = USBLIB->prevState; break; case RESUME_INTERNAL: usb_resume_init(); @@ -151,8 +154,9 @@ static void usb_resume(RESUME_STATE eResumeSetVal) { break; case RESUME_WAIT: ResumeS.bESOFcnt--; - if (ResumeS.bESOFcnt == 0) + if (ResumeS.bESOFcnt == 0) { ResumeS.eState = RESUME_START; + } break; case RESUME_START: cntr = USB_BASE->CNTR; @@ -167,6 +171,7 @@ static void usb_resume(RESUME_STATE eResumeSetVal) { cntr = USB_BASE->CNTR; cntr &= ~USB_CNTR_RESUME; USB_BASE->CNTR = cntr; + USBLIB->state = USBLIB->prevState; ResumeS.eState = RESUME_OFF; } break; @@ -175,7 +180,7 @@ static void usb_resume(RESUME_STATE eResumeSetVal) { default: ResumeS.eState = RESUME_OFF; break; - } + } } #define SUSPEND_ENABLED 1 @@ -274,8 +279,9 @@ static void dispatch_ctr_lp() { * once we're done serving endpoint zero, but not okay if * there are multiple nonzero endpoint transfers to * handle. */ - if (dispatch_endpt_zero(istr & USB_ISTR_DIR)) + if (dispatch_endpt_zero(istr & USB_ISTR_DIR)) { return; + } } else { dispatch_endpt(ep_id); } -- cgit v1.2.3 From 07b56b89fba5e8f7e87781bfa03dedcf80356c43 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Mon, 29 Apr 2013 10:19:42 -0400 Subject: libmaple/usb/stm32f1/usb.c: fix build error. Signed-off-by: Marti Bolivar --- libmaple/usb/stm32f1/usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmaple/usb/stm32f1/usb.c b/libmaple/usb/stm32f1/usb.c index b19ce33..3116e44 100644 --- a/libmaple/usb/stm32f1/usb.c +++ b/libmaple/usb/stm32f1/usb.c @@ -135,7 +135,7 @@ static void usb_resume(RESUME_STATE eResumeSetVal) { uint16 cntr; if (eResumeSetVal != RESUME_ESOF) { - ResumeS.eState = eResumeSetVal + ResumeS.eState = eResumeSetVal; } switch (ResumeS.eState) { -- cgit v1.2.3 From d0d14ce9672ba40ad90224469a9f451c8f9afa8d Mon Sep 17 00:00:00 2001 From: mlundinse Date: Mon, 29 Apr 2013 17:21:27 +0200 Subject: usb_midi_device: Reset transmitting flag in usbReset() --- libmaple/usb/stm32f1/usb_midi_device.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libmaple/usb/stm32f1/usb_midi_device.c b/libmaple/usb/stm32f1/usb_midi_device.c index 02a0ba2..7de7fe1 100644 --- a/libmaple/usb/stm32f1/usb_midi_device.c +++ b/libmaple/usb/stm32f1/usb_midi_device.c @@ -443,6 +443,7 @@ static void usbReset(void) { n_unsent_bytes = 0; rx_offset = 0; tx_offset = 0; + transmitting = 0; } static RESULT usbDataSetup(uint8 request) { -- cgit v1.2.3 From 651faf0a803c587a683bf14d531ce9f16013faeb Mon Sep 17 00:00:00 2001 From: mlundinse Date: Mon, 29 Apr 2013 21:16:37 +0200 Subject: Added board.mk makefile with board specific defines --- README | 14 ++++++++++++++ wirish/boards/maple/board.mk | 12 ++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 wirish/boards/maple/board.mk diff --git a/README b/README index 400e656..33ad1a2 100644 --- a/README +++ b/README @@ -7,7 +7,21 @@ |_| by LeafLabs! leaflabs.com +/************************************************************************************ +Cloned directory with experimental modifications to Leaflabs main libmaple code + +Work in progress include: +* usb-midi, currently only for stm32f1xxx targets +* stm32f4 support, i2c is working +* support for Netduino 2 and Netduino plus 2 + +All experimental code needs more cleanup and testing, so it is supplied as is :) + +Magnus Lundin +lundin@mlu.mine.nu + +*************************************************************************************/ The latest version of this repository can be found here: https://github.com/leaflabs/libmaple diff --git a/wirish/boards/maple/board.mk b/wirish/boards/maple/board.mk new file mode 100644 index 0000000..e31d777 --- /dev/null +++ b/wirish/boards/maple/board.mk @@ -0,0 +1,12 @@ +# Board specific make defines for Maple board + +CPU = cortex-m3 +ARCH = armv7-m +MCU_SERIES = stm32f1 +MCU = MCU_STM32F103RB +MEMORY = sram_20k_flash_128k +ifeq ($(TARGET),jtag) +DFUID = 0483:df11 +DFUALT = 0 +endif + -- cgit v1.2.3 From 1f493e6a48760873c18f3b4ffbf405129b9400d0 Mon Sep 17 00:00:00 2001 From: mlundinse Date: Mon, 29 Apr 2013 21:19:06 +0200 Subject: Linker files for F20x boards with 768k flash --- support/ld/extra_libs.inc | 1 + support/ld/stm32/mem/sram_112k_flash_768k/mem-jtag.inc | 5 +++++ support/ld/stm32/mem/sram_112k_flash_768k/mem-ram.inc | 5 +++++ 3 files changed, 11 insertions(+) create mode 100644 support/ld/extra_libs.inc create mode 100644 support/ld/stm32/mem/sram_112k_flash_768k/mem-jtag.inc create mode 100644 support/ld/stm32/mem/sram_112k_flash_768k/mem-ram.inc diff --git a/support/ld/extra_libs.inc b/support/ld/extra_libs.inc new file mode 100644 index 0000000..1216f97 --- /dev/null +++ b/support/ld/extra_libs.inc @@ -0,0 +1 @@ +/* toolchain specific stuff */ diff --git a/support/ld/stm32/mem/sram_112k_flash_768k/mem-jtag.inc b/support/ld/stm32/mem/sram_112k_flash_768k/mem-jtag.inc new file mode 100644 index 0000000..d62fb7a --- /dev/null +++ b/support/ld/stm32/mem/sram_112k_flash_768k/mem-jtag.inc @@ -0,0 +1,5 @@ +MEMORY +{ + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 112K + rom (rx) : ORIGIN = 0x08000000, LENGTH = 768K +} diff --git a/support/ld/stm32/mem/sram_112k_flash_768k/mem-ram.inc b/support/ld/stm32/mem/sram_112k_flash_768k/mem-ram.inc new file mode 100644 index 0000000..d21f17c --- /dev/null +++ b/support/ld/stm32/mem/sram_112k_flash_768k/mem-ram.inc @@ -0,0 +1,5 @@ +MEMORY +{ + ram (rwx) : ORIGIN = 0x20000000, LENGTH = 112K + rom (rx) : ORIGIN = 0x08000000, LENGTH = 0K +} -- cgit v1.2.3 From 0fca062e2d438bff98e26f6544299c69ec70b8ff Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Tue, 30 Apr 2013 09:22:31 -0400 Subject: libmaple/usb/stm32f1/usb.c: cosmetics. Whitespace and comments. Signed-off-by: Marti Bolivar --- libmaple/usb/stm32f1/usb.c | 198 ++++++++++++++++++++++----------------------- 1 file changed, 99 insertions(+), 99 deletions(-) diff --git a/libmaple/usb/stm32f1/usb.c b/libmaple/usb/stm32f1/usb.c index 3116e44..f694f04 100644 --- a/libmaple/usb/stm32f1/usb.c +++ b/libmaple/usb/stm32f1/usb.c @@ -28,7 +28,7 @@ * @file libmaple/usb/stm32f1/usb.c * @brief USB support. * - * This is a mess. What we need almost amounts to a ground-up rewrite. + * This is a mess. */ #include @@ -69,8 +69,8 @@ typedef enum { } RESUME_STATE; struct { - volatile RESUME_STATE eState; - volatile uint8 bESOFcnt; + volatile RESUME_STATE eState; + volatile uint8 bESOFcnt; } ResumeS; static usblib_dev usblib = { @@ -106,151 +106,151 @@ void usb_init_usblib(usblib_dev *dev, } static void usb_suspend(void) { - uint16 cntr; - - /* TODO decide if read/modify/write is really what we want - * (e.g. usb_resume_init() reconfigures CNTR). */ - cntr = USB_BASE->CNTR; - cntr |= USB_CNTR_FSUSP; - USB_BASE->CNTR = cntr; - cntr |= USB_CNTR_LP_MODE; - USB_BASE->CNTR = cntr; - - USBLIB->prevState = USBLIB->state; - USBLIB->state = USB_SUSPENDED; + uint16 cntr; + + /* TODO decide if read/modify/write is really what we want + * (e.g. usb_resume_init() reconfigures CNTR). */ + cntr = USB_BASE->CNTR; + cntr |= USB_CNTR_FSUSP; + USB_BASE->CNTR = cntr; + cntr |= USB_CNTR_LP_MODE; + USB_BASE->CNTR = cntr; + + USBLIB->prevState = USBLIB->state; + USBLIB->state = USB_SUSPENDED; } static void usb_resume_init(void) { - uint16 cntr; + uint16 cntr; - cntr = USB_BASE->CNTR; - cntr &= ~USB_CNTR_LP_MODE; - USB_BASE->CNTR = cntr; + cntr = USB_BASE->CNTR; + cntr &= ~USB_CNTR_LP_MODE; + USB_BASE->CNTR = cntr; - /* Enable interrupt lines */ - USB_BASE->CNTR = USB_ISR_MSK; + /* Enable interrupt lines */ + USB_BASE->CNTR = USB_ISR_MSK; } static void usb_resume(RESUME_STATE eResumeSetVal) { - uint16 cntr; + uint16 cntr; - if (eResumeSetVal != RESUME_ESOF) { - ResumeS.eState = eResumeSetVal; - } + if (eResumeSetVal != RESUME_ESOF) { + ResumeS.eState = eResumeSetVal; + } - switch (ResumeS.eState) { + switch (ResumeS.eState) { case RESUME_EXTERNAL: - usb_resume_init(); - ResumeS.eState = RESUME_OFF; - USBLIB->state = USBLIB->prevState; - break; + usb_resume_init(); + ResumeS.eState = RESUME_OFF; + USBLIB->state = USBLIB->prevState; + break; case RESUME_INTERNAL: - usb_resume_init(); - ResumeS.eState = RESUME_START; - break; + usb_resume_init(); + ResumeS.eState = RESUME_START; + break; case RESUME_LATER: - ResumeS.bESOFcnt = 2; - ResumeS.eState = RESUME_WAIT; - break; + ResumeS.bESOFcnt = 2; + ResumeS.eState = RESUME_WAIT; + break; case RESUME_WAIT: - ResumeS.bESOFcnt--; - if (ResumeS.bESOFcnt == 0) { - ResumeS.eState = RESUME_START; - } - break; + ResumeS.bESOFcnt--; + if (ResumeS.bESOFcnt == 0) { + ResumeS.eState = RESUME_START; + } + break; case RESUME_START: - cntr = USB_BASE->CNTR; - cntr |= USB_CNTR_RESUME; - USB_BASE->CNTR = cntr; - ResumeS.eState = RESUME_ON; - ResumeS.bESOFcnt = 10; - break; + cntr = USB_BASE->CNTR; + cntr |= USB_CNTR_RESUME; + USB_BASE->CNTR = cntr; + ResumeS.eState = RESUME_ON; + ResumeS.bESOFcnt = 10; + break; case RESUME_ON: - ResumeS.bESOFcnt--; - if (ResumeS.bESOFcnt == 0) { - cntr = USB_BASE->CNTR; - cntr &= ~USB_CNTR_RESUME; - USB_BASE->CNTR = cntr; - USBLIB->state = USBLIB->prevState; - ResumeS.eState = RESUME_OFF; - } - break; + ResumeS.bESOFcnt--; + if (ResumeS.bESOFcnt == 0) { + cntr = USB_BASE->CNTR; + cntr &= ~USB_CNTR_RESUME; + USB_BASE->CNTR = cntr; + USBLIB->state = USBLIB->prevState; + ResumeS.eState = RESUME_OFF; + } + break; case RESUME_OFF: case RESUME_ESOF: default: - ResumeS.eState = RESUME_OFF; - break; - } + ResumeS.eState = RESUME_OFF; + break; + } } #define SUSPEND_ENABLED 1 void __irq_usb_lp_can_rx0(void) { - uint16 istr = USB_BASE->ISTR; + uint16 istr = USB_BASE->ISTR; - /* Use USB_ISR_MSK to only include code for bits we care about. */ + /* Use USB_ISR_MSK to only include code for bits we care about. */ #if (USB_ISR_MSK & USB_ISTR_RESET) - if (istr & USB_ISTR_RESET & USBLIB->irq_mask) { - USB_BASE->ISTR = ~USB_ISTR_RESET; - pProperty->Reset(); - } + if (istr & USB_ISTR_RESET & USBLIB->irq_mask) { + USB_BASE->ISTR = ~USB_ISTR_RESET; + pProperty->Reset(); + } #endif #if (USB_ISR_MSK & USB_ISTR_PMAOVR) - if (istr & ISTR_PMAOVR & USBLIB->irq_mask) { - USB_BASE->ISTR = ~USB_ISTR_PMAOVR; - } + if (istr & ISTR_PMAOVR & USBLIB->irq_mask) { + USB_BASE->ISTR = ~USB_ISTR_PMAOVR; + } #endif #if (USB_ISR_MSK & USB_ISTR_ERR) - if (istr & USB_ISTR_ERR & USBLIB->irq_mask) { - USB_BASE->ISTR = ~USB_ISTR_ERR; - } + if (istr & USB_ISTR_ERR & USBLIB->irq_mask) { + USB_BASE->ISTR = ~USB_ISTR_ERR; + } #endif #if (USB_ISR_MSK & USB_ISTR_WKUP) - if (istr & USB_ISTR_WKUP & USBLIB->irq_mask) { - USB_BASE->ISTR = ~USB_ISTR_WKUP; - usb_resume(RESUME_EXTERNAL); - } + if (istr & USB_ISTR_WKUP & USBLIB->irq_mask) { + USB_BASE->ISTR = ~USB_ISTR_WKUP; + usb_resume(RESUME_EXTERNAL); + } #endif #if (USB_ISR_MSK & USB_ISTR_SUSP) - if (istr & USB_ISTR_SUSP & USBLIB->irq_mask) { - /* check if SUSPEND is possible */ - if (SUSPEND_ENABLED) { - usb_suspend(); - } else { - /* if not possible then resume after xx ms */ - usb_resume(RESUME_LATER); + if (istr & USB_ISTR_SUSP & USBLIB->irq_mask) { + /* check if SUSPEND is possible */ + if (SUSPEND_ENABLED) { + usb_suspend(); + } else { + /* if not possible then resume after xx ms */ + usb_resume(RESUME_LATER); + } + /* clear of the ISTR bit must be done after setting of CNTR_FSUSP */ + USB_BASE->ISTR = ~USB_ISTR_SUSP; } - /* clear of the ISTR bit must be done after setting of CNTR_FSUSP */ - USB_BASE->ISTR = ~USB_ISTR_SUSP; -} #endif #if (USB_ISR_MSK & USB_ISTR_SOF) - if (istr & USB_ISTR_SOF & USBLIB->irq_mask) { - USB_BASE->ISTR = ~USB_ISTR_SOF; - } + if (istr & USB_ISTR_SOF & USBLIB->irq_mask) { + USB_BASE->ISTR = ~USB_ISTR_SOF; + } #endif #if (USB_ISR_MSK & USB_ISTR_ESOF) - if (istr & USB_ISTR_ESOF & USBLIB->irq_mask) { - USB_BASE->ISTR = ~USB_ISTR_ESOF; - /* resume handling timing is made with ESOFs */ - usb_resume(RESUME_ESOF); /* request without change of the machine state */ - } + if (istr & USB_ISTR_ESOF & USBLIB->irq_mask) { + USB_BASE->ISTR = ~USB_ISTR_ESOF; + /* resume handling timing is made with ESOFs */ + usb_resume(RESUME_ESOF); /* request without change of the machine state */ + } #endif - /* - * Service the correct transfer interrupt. - */ + /* + * Service the correct transfer interrupt. + */ #if (USB_ISR_MSK & USB_ISTR_CTR) - if (istr & USB_ISTR_CTR & USBLIB->irq_mask) { - dispatch_ctr_lp(); - } + if (istr & USB_ISTR_CTR & USBLIB->irq_mask) { + dispatch_ctr_lp(); + } #endif } -- cgit v1.2.3 From f66451de160d0ec1e99500ba569a00eb0c21851f Mon Sep 17 00:00:00 2001 From: Magnus Lundin Date: Thu, 2 May 2013 11:37:32 -0400 Subject: wirish/syscalls.c: add weak exit function. For toolchains which require an exit function. Signed-off-by: Marti Bolivar --- wirish/syscalls.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wirish/syscalls.c b/wirish/syscalls.c index 1e62d51..a3b6d2c 100644 --- a/wirish/syscalls.c +++ b/wirish/syscalls.c @@ -168,3 +168,8 @@ __weak char *fgets(char *s, int bufsize, void *f) { cgets(s, bufsize); return s; } + +__weak void _exit(int exitcode) { + while (1) + ; +} -- cgit v1.2.3 From 63f3c453f8fd2a7fe1c2dde9fdb22f1802681384 Mon Sep 17 00:00:00 2001 From: mlundinse Date: Thu, 2 May 2013 18:31:45 +0200 Subject: Reverted work change --- wirish/stm32f1/boards_setup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wirish/stm32f1/boards_setup.cpp b/wirish/stm32f1/boards_setup.cpp index ca1a43c..11872d5 100644 --- a/wirish/stm32f1/boards_setup.cpp +++ b/wirish/stm32f1/boards_setup.cpp @@ -75,7 +75,7 @@ namespace wirish { __weak void board_setup_usb(void) { #if BOARD_HAVE_SERIALUSB - //SerialUSB.begin(); + SerialUSB.begin(); #endif } -- cgit v1.2.3 From 206c09adc6bbebc9984e9c4e3ea998df8bc13af3 Mon Sep 17 00:00:00 2001 From: mlundinse Date: Thu, 2 May 2013 21:44:38 +0200 Subject: usb_midi_device - Control build with USB_TYPE build flag usb_midi_device - Control build with USB_TYPE build flag Signed-off-by: Magnus Lundin --- libmaple/usb/stm32f1/usb_midi_device.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/libmaple/usb/stm32f1/usb_midi_device.c b/libmaple/usb/stm32f1/usb_midi_device.c index 7de7fe1..9d46cc2 100644 --- a/libmaple/usb/stm32f1/usb_midi_device.c +++ b/libmaple/usb/stm32f1/usb_midi_device.c @@ -129,18 +129,22 @@ static void (*ep_int_out[7])(void) = /* * Globals required by usb_lib/ * - * Mark these weak so they can be overriden to implement other USB - * functionality. + * These will override _weak defines in usb_cdcasm.c + * */ +#if defined(USB_TYPE) && (USB_TYPE==USB_MIDI) + #define NUM_ENDPTS 0x04 -__weak DEVICE Device_Table = { + +DEVICE Device_Table = { .Total_Endpoint = NUM_ENDPTS, .Total_Configuration = 1 }; #define MAX_PACKET_SIZE 0x40 /* 64B, maximum for USB FS Devices */ -__weak DEVICE_PROP Device_Property = { + +DEVICE_PROP Device_Property = { .Init = usbInit, .Reset = usbReset, .Process_Status_IN = NOP_Process, @@ -155,7 +159,7 @@ __weak DEVICE_PROP Device_Property = { .MaxPacketSize = MAX_PACKET_SIZE }; -__weak USER_STANDARD_REQUESTS User_Standard_Requests = { +USER_STANDARD_REQUESTS User_Standard_Requests = { .User_GetConfiguration = NOP_Process, .User_SetConfiguration = usbSetConfiguration, .User_GetInterface = NOP_Process, @@ -490,3 +494,5 @@ static void usbSetConfiguration(void) { static void usbSetDeviceAddress(void) { USBLIB->state = USB_ADDRESSED; } + +#endif -- cgit v1.2.3 From f11dc6be4f55ff8450416c3ce5a1018398376b8a Mon Sep 17 00:00:00 2001 From: mlundinse Date: Sat, 4 May 2013 09:42:25 +0200 Subject: Use linker symbol __text_start__ to setup base of nvic vector table. Signed-off-by: Magnus Lundin Signed-off-by: Marti Bolivar --- wirish/boards.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/wirish/boards.cpp b/wirish/boards.cpp index e053245..a693fa6 100644 --- a/wirish/boards.cpp +++ b/wirish/boards.cpp @@ -143,15 +143,11 @@ static void setup_clocks(void) { * These addresses are where usercode starts when a bootloader is * present. If no bootloader is present, the user NVIC usually starts * at the Flash base address, 0x08000000. - * - * FIXME Let the build specify the vector table address numerically to - * avoid having these magic values -- some people have been fixing up - * the bootloader so it uses less space. */ #define USER_ADDR_ROM 0x08005000 #define USER_ADDR_RAM 0x20000C00 extern char __text_start__; - + static void setup_nvic(void) { #ifdef VECT_TAB_FLASH nvic_init(USER_ADDR_ROM, 0); @@ -163,7 +159,8 @@ static void setup_nvic(void) { // A numerically supplied value nvic_init((uint32)VECT_TAB_ADDR, 0); #else - // Use the __text_start__ value from the linker scipt, this should be the start of the vector table + // Use the __text_start__ value from the linker script; this + // should be the start of the vector table. nvic_init((uint32)&__text_start__, 0); #endif } -- cgit v1.2.3