From 9ff6e8120ab459ffd548e8785ca197f22e86f0b3 Mon Sep 17 00:00:00 2001 From: Andrzej Puzdrowski Date: Wed, 4 Jan 2017 11:48:38 +0100 Subject: [PATCH] Enabled nRF52840_DK's compilation for IAR IDE: - corected scater & startup file for IAR EW - fix warnings caused by port_api.c, ble_radio_notification.c, nrf_drv_spi.c (for IAR it was error), serial_api.c --- .../device/TOOLCHAIN_IAR/nRF52832.icf | 8 ++-- .../TOOLCHAIN_IAR/startup_NRF52832_IAR.s | 38 ++++++++++++++++++- .../TARGET_NRF5_SDK13/port_api.c | 2 +- .../ble_radio_notification.c | 1 + .../sdk/drivers_nrf/spi_master/nrf_drv_spi.c | 4 +- .../TARGET_NRF5_SDK13/serial_api.c | 8 ++-- 6 files changed, 49 insertions(+), 12 deletions(-) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52832.icf b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52832.icf index d8dee15e57..4fa73dd2c8 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52832.icf +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/nRF52832.icf @@ -2,12 +2,12 @@ /*-Editor annotation file-*/ /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ /*-Specials-*/ -define symbol __ICFEDIT_intvec_start__ = 0x1c000; +define symbol __ICFEDIT_intvec_start__ = 0x21000; /*-Memory Regions-*/ -define symbol __ICFEDIT_region_ROM_start__ = 0x1c000; -define symbol __ICFEDIT_region_ROM_end__ = 0x7ffff; +define symbol __ICFEDIT_region_ROM_start__ = 0x21000; +define symbol __ICFEDIT_region_ROM_end__ = 0xfffff; define symbol __ICFEDIT_region_RAM_start__ = 0x20002ef8; -define symbol __ICFEDIT_region_RAM_end__ = 0x2000ffff; +define symbol __ICFEDIT_region_RAM_end__ = 0x2003ffff; export symbol __ICFEDIT_region_RAM_start__; export symbol __ICFEDIT_region_RAM_end__; /*-Sizes-*/ diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/startup_NRF52832_IAR.s b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/startup_NRF52832_IAR.s index b27d189e7d..26ba439712 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/startup_NRF52832_IAR.s +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/TARGET_MCU_NRF52840/device/TOOLCHAIN_IAR/startup_NRF52832_IAR.s @@ -118,7 +118,13 @@ __vector_table DCD RTC2_IRQHandler_v DCD I2S_IRQHandler_v DCD FPU_IRQHandler_v - + DCD USBD_IRQHandler_v + DCD UARTE1_IRQHandler_v + DCD QSPI_IRQHandler_v + DCD CRYPTOCELL_IRQHandler_v + DCD SPIM3_IRQHandler_v + DCD 0 /*Reserved */ + DCD PWM3_IRQHandler_v __Vectors_End __Vectors EQU __vector_table @@ -375,6 +381,36 @@ I2S_IRQHandler_v FPU_IRQHandler_v B . + PUBWEAK USBD_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +USBD_IRQHandler_v + B . + + PUBWEAK UARTE1_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +UARTE1_IRQHandler_v + B . + + PUBWEAK QSPI_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +QSPI_IRQHandler_v + B . + + PUBWEAK CRYPTOCELL_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +CRYPTOCELL_IRQHandler_v + B . + + PUBWEAK SPIM3_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +SPIM3_IRQHandler_v + B . + + PUBWEAK PWM3_IRQHandler_v + SECTION .text:CODE:NOROOT(1) +PWM3_IRQHandler_v + B . + END diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/port_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/port_api.c index bb689e2fbe..9b7849c78c 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/port_api.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/port_api.c @@ -45,7 +45,7 @@ static NRF_GPIO_Type * const m_ports[] = GPIO_REG_LIST; PinName port_pin(PortName port, int pin_n) { - return NRF_GPIO_PIN_MAP(port, pin_n); + return (PinName)NRF_GPIO_PIN_MAP(port, pin_n); } void port_init(port_t *obj, PortName port, int mask, PinDirection dir) diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_radio_notification/ble_radio_notification.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_radio_notification/ble_radio_notification.c index 22989aff22..1f424e7386 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_radio_notification/ble_radio_notification.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/ble/ble_radio_notification/ble_radio_notification.c @@ -37,6 +37,7 @@ */ #include "ble_radio_notification.h" +#include "nrf_nvic.h" #include diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.c index b015d55805..ac6433b8e6 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/sdk/drivers_nrf/spi_master/nrf_drv_spi.c @@ -611,8 +611,8 @@ void nrf_drv_spi_abort(nrf_drv_spi_t const * p_instance) CODE_FOR_SPIM ( - nrf_spim_task_trigger(p_instance, NRF_SPIM_TASK_STOP); - while (!nrf_spim_event_check(p_instance, NRF_SPIM_EVENT_STOPPED)) {} + nrf_spim_task_trigger(p_instance->p_registers, NRF_SPIM_TASK_STOP); + while (!nrf_spim_event_check(p_instance->p_registers, NRF_SPIM_EVENT_STOPPED)) {} p_cb->transfer_in_progress = false; ) CODE_FOR_SPI diff --git a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/serial_api.c b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/serial_api.c index 3a219ad449..55c4be419c 100644 --- a/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/serial_api.c +++ b/targets/TARGET_NORDIC/TARGET_NRF5_SDK13/serial_api.c @@ -283,9 +283,9 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) { nrf_uart_enable(UART_INSTANCE); } else { - UART_CB.baudrate = UART_DEFAULT_BAUDRATE; - UART_CB.parity = UART_DEFAULT_PARITY; - UART_CB.hwfc = UART_DEFAULT_HWFC; + UART_CB.baudrate = (nrf_uart_baudrate_t)UART_DEFAULT_BAUDRATE; + UART_CB.parity = (nrf_uart_parity_t)UART_DEFAULT_PARITY; + UART_CB.hwfc = (nrf_uart_hwfc_t)UART_DEFAULT_HWFC; UART_CB.pselcts = UART_DEFAULT_CTS; UART_CB.pselrts = UART_DEFAULT_RTS; @@ -554,7 +554,7 @@ static void internal_set_hwfc(FlowControl type, nrf_gpio_cfg_input(UART_CB.pselcts, NRF_GPIO_PIN_NOPULL); } - UART_CB.hwfc = (type == FlowControlNone)? NRF_UART_HWFC_DISABLED : UART_DEFAULT_CONFIG_HWFC; + UART_CB.hwfc = (nrf_uart_hwfc_t)((type == FlowControlNone)? NRF_UART_HWFC_DISABLED : UART_DEFAULT_CONFIG_HWFC); nrf_uart_configure(UART_INSTANCE, UART_CB.parity, UART_CB.hwfc); nrf_uart_hwfc_pins_set(UART_INSTANCE, UART_CB.pselrts, UART_CB.pselcts);