diff --git a/arch/x86/gen_idt.py b/arch/x86/gen_idt.py index 8d8bab0270ba..c2e9e1f1fd76 100755 --- a/arch/x86/gen_idt.py +++ b/arch/x86/gen_idt.py @@ -7,7 +7,7 @@ """Generate Interrupt Descriptor Table for x86 CPUs. This script generates the interrupt descriptor table (IDT) for x86. -Please consule the IA Architecture SW Developer Manual, volume 3, +Please consult the IA Architecture SW Developer Manual, volume 3, for more details on this data structure. This script accepts as input the zephyr_prebuilt.elf binary, diff --git a/boards/arc/em_starterkit/em_starterkit_defconfig b/boards/arc/em_starterkit/em_starterkit_defconfig index 500a46427a54..4c680ee9c3f6 100644 --- a/boards/arc/em_starterkit/em_starterkit_defconfig +++ b/boards/arc/em_starterkit/em_starterkit_defconfig @@ -5,6 +5,7 @@ CONFIG_SOC_EMSK=y CONFIG_SOC_EMSK_EM9D=y CONFIG_BOARD_EM_STARTERKIT=y CONFIG_BOARD_EM_STARTERKIT_R23=y +CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 CONFIG_XIP=n CONFIG_BUILD_NO_GAP_FILL=y CONFIG_BUILD_OUTPUT_BIN=n diff --git a/boards/arc/em_starterkit/em_starterkit_em11d_defconfig b/boards/arc/em_starterkit/em_starterkit_em11d_defconfig index 6d512b357e46..471631f1596f 100644 --- a/boards/arc/em_starterkit/em_starterkit_em11d_defconfig +++ b/boards/arc/em_starterkit/em_starterkit_em11d_defconfig @@ -6,6 +6,7 @@ CONFIG_SOC_EMSK_EM11D=y CONFIG_BOARD_EM_STARTERKIT=y CONFIG_BOARD_EM_STARTERKIT_R23=y CONFIG_XIP=n +CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 CONFIG_BUILD_NO_GAP_FILL=y CONFIG_BUILD_OUTPUT_BIN=n CONFIG_PRINTK=y diff --git a/boards/arc/em_starterkit/em_starterkit_em7d_defconfig b/boards/arc/em_starterkit/em_starterkit_em7d_defconfig index 0d83cc6eabeb..d2f93b16ac20 100644 --- a/boards/arc/em_starterkit/em_starterkit_em7d_defconfig +++ b/boards/arc/em_starterkit/em_starterkit_em7d_defconfig @@ -6,6 +6,7 @@ CONFIG_SOC_EMSK_EM7D=y CONFIG_BOARD_EM_STARTERKIT=y CONFIG_BOARD_EM_STARTERKIT_R23=y CONFIG_XIP=n +CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 CONFIG_BUILD_NO_GAP_FILL=y CONFIG_BUILD_OUTPUT_BIN=n CONFIG_PRINTK=y diff --git a/boards/arc/em_starterkit/em_starterkit_em7d_v22_defconfig b/boards/arc/em_starterkit/em_starterkit_em7d_v22_defconfig index 34716f471831..33db52d35290 100644 --- a/boards/arc/em_starterkit/em_starterkit_em7d_v22_defconfig +++ b/boards/arc/em_starterkit/em_starterkit_em7d_v22_defconfig @@ -6,6 +6,7 @@ CONFIG_SOC_EMSK_EM7D=y CONFIG_BOARD_EM_STARTERKIT=y CONFIG_BOARD_EM_STARTERKIT_R22=y CONFIG_XIP=n +CONFIG_SYS_CLOCK_TICKS_PER_SEC=100 CONFIG_BUILD_NO_GAP_FILL=y CONFIG_BUILD_OUTPUT_BIN=n CONFIG_PRINTK=y diff --git a/boards/arm/frdm_k82f/frdm_k82f.dts b/boards/arm/frdm_k82f/frdm_k82f.dts index 1e3a6c5d1e4b..de20ad46d98a 100644 --- a/boards/arm/frdm_k82f/frdm_k82f.dts +++ b/boards/arm/frdm_k82f/frdm_k82f.dts @@ -106,6 +106,10 @@ }; }; +&adc0 { + status = "okay"; +}; + &gpioa { status = "okay"; }; diff --git a/boards/arm/frdm_k82f/frdm_k82f.yaml b/boards/arm/frdm_k82f/frdm_k82f.yaml index c657f5ca99b6..1d2f1fe0c32b 100644 --- a/boards/arm/frdm_k82f/frdm_k82f.yaml +++ b/boards/arm/frdm_k82f/frdm_k82f.yaml @@ -9,6 +9,7 @@ toolchain: ram: 192 flash: 256 supported: + - adc - arduino_gpio - gpio - i2c diff --git a/boards/arm/frdm_k82f/pinmux.c b/boards/arm/frdm_k82f/pinmux.c index f1ab51aea527..534fa84b4733 100644 --- a/boards/arm/frdm_k82f/pinmux.c +++ b/boards/arm/frdm_k82f/pinmux.c @@ -77,6 +77,11 @@ static int frdm_k82f_pinmux_init(struct device *dev) pinmux_pin_set(portc, 15, PORT_PCR_MUX(kPORT_MuxAlt3)); #endif +#if DT_NODE_HAS_STATUS(DT_NODELABEL(adc0), okay) + /* ADC0_SE15 */ + pinmux_pin_set(portc, 1, PORT_PCR_MUX(kPORT_PinDisabledOrAnalog)); +#endif + return 0; } diff --git a/cmake/app/boilerplate.cmake b/cmake/app/boilerplate.cmake index 8f0a41d7b5b7..e4197581c1e9 100644 --- a/cmake/app/boilerplate.cmake +++ b/cmake/app/boilerplate.cmake @@ -89,8 +89,6 @@ if((NOT DEFINED ZEPHYR_BASE) AND (DEFINED ENV_ZEPHYR_BASE)) set(ZEPHYR_BASE ${ENV_ZEPHYR_BASE} CACHE PATH "Zephyr base") endif() -find_package(ZephyrExtension PATHS ${ZEPHYR_BASE}/../* QUIET NO_DEFAULT_PATH NO_POLICY_SCOPE) - # Note any later project() resets PROJECT_SOURCE_DIR file(TO_CMAKE_PATH "${ZEPHYR_BASE}" PROJECT_SOURCE_DIR) diff --git a/doc/guides/zephyr_cmake_package.rst b/doc/guides/zephyr_cmake_package.rst index 608f8a1ab97f..29b12739a2ae 100644 --- a/doc/guides/zephyr_cmake_package.rst +++ b/doc/guides/zephyr_cmake_package.rst @@ -382,48 +382,6 @@ Such a CMakeLists.txt could look as: project(my_first_app) -.. _cmake_extension_package: - -Zephyr Extension CMake package -****************************** - -The Zephyr Extension CMake package provides a possibility for a Zephyr based system to control -Zephyr build settings in a generic way. -The Zephyr Extension CMake package will be loaded in the Zephyr boilerplate code after initial -properties and ``ZEPHYR_BASE`` has been defined, but before CMake code execution. -This allows the Zephyr Extension CMake package to setup or extend properties such as: ``DTS_ROOT``, -``BOARD_ROOT``, Fixed overlays, and any other property that can be controlled. - -To provide a Zephyr Extension CMake package, create ``ZephyrExtensionConfig.cmake`` and place it in -a Zephyr workspace top-level folder as: - -.. code-block:: none - - /zephyr-workspace - ├── zephyr - ├── ... - └── zephyr_extension_project (can be named anything) - └── share/zephyrextension-package/cmake/ZephyrExtensionConfig.cmake - -The Zephyr Extension CMake package will not search in any CMake default search paths, and thus -cannot be installed in the CMake package registry. There will be no version checking on the Zephyr -Extension package, as it is the responsibility of the project to ensure that the Zephyr project and -the ``zephyr_extension_project`` matches in the Zephyr workspace. - -A sample ``ZephyrExtensionConfig.cmake`` can be seen below. - -.. code-block:: cmake - - # ZephyrExtensionConfig.cmake sample code - - # To ensure final path is absolute and does not contain ../.. in variable. - get_filename_component(EXTENSION_PROJECT_DIR - ${CMAKE_CURRENT_LIST_DIR}/../../.. - ABSOLUTE - ) - - list(APPEND BOARD_ROOT ${EXTENSION_PROJECT_DIR}) - Zephyr CMake package source code ******************************** diff --git a/drivers/flash/nrf_qspi_nor.c b/drivers/flash/nrf_qspi_nor.c index 5c5c7dc98623..94f9861856e0 100644 --- a/drivers/flash/nrf_qspi_nor.c +++ b/drivers/flash/nrf_qspi_nor.c @@ -491,12 +491,19 @@ static inline int qspi_nor_read_id(struct device *dev, static int qspi_nor_read(struct device *dev, off_t addr, void *dest, size_t size) { + void *dptr = dest; + size_t dlen = size; + u8_t buf[4]; + if (!dest) { return -EINVAL; } /* read size must be non-zero multiple of 4 bytes */ - if (((size % 4U) != 0) || (size == 0)) { + if (size < 4U) { + dest = buf; + size = sizeof(buf); + } else if (((size % 4U) != 0) || (size == 0)) { return -EINVAL; } /* address must be 4-byte aligned */ @@ -523,7 +530,13 @@ static int qspi_nor_read(struct device *dev, off_t addr, void *dest, qspi_wait_for_completion(dev, res); - return qspi_get_zephyr_ret_code(res); + int rc = qspi_get_zephyr_ret_code(res); + + if ((rc == 0) && (dest != dptr)) { + memcpy(dptr, dest, dlen); + } + + return rc; } static int qspi_nor_write(struct device *dev, off_t addr, const void *src, diff --git a/drivers/modem/ublox-sara-r4.c b/drivers/modem/ublox-sara-r4.c index 3b8235473dfd..cbb8bad3653c 100644 --- a/drivers/modem/ublox-sara-r4.c +++ b/drivers/modem/ublox-sara-r4.c @@ -1578,11 +1578,26 @@ static int offload_getaddrinfo(const char *node, const char *service, result.ai_addrlen = sizeof(result_addr); result.ai_canonname = result_canonname; result_canonname[0] = '\0'; + + if (service) { + port = ATOI(service, 0U, "port"); + if (port < 1 || port > USHRT_MAX) { + return EAI_SERVICE; + } + } + + if (port > 0U) { + /* FIXME: DNS is hard-coded to return only IPv4 */ + if (result.ai_family == AF_INET) { + net_sin(&result_addr)->sin_port = htons(port); + } + } + /* check to see if node is an IP address */ if (net_addr_pton(result.ai_family, node, &((struct sockaddr_in *)&result_addr)->sin_addr) - == 1) { + == 0) { *res = &result; return 0; } @@ -1592,12 +1607,13 @@ static int offload_getaddrinfo(const char *node, const char *service, return EAI_NONAME; } - if (service) { +/* if (service) { port = ATOI(service, 0U, "port"); if (port < 1 || port > USHRT_MAX) { return EAI_SERVICE; } } +*/ snprintk(sendbuf, sizeof(sendbuf), "AT+UDNSRN=0,\"%s\"", node); ret = modem_cmd_send(&mctx.iface, &mctx.cmd_handler, @@ -1607,12 +1623,7 @@ static int offload_getaddrinfo(const char *node, const char *service, return ret; } - if (port > 0U) { - /* FIXME: DNS is hard-coded to return only IPv4 */ - if (result.ai_family == AF_INET) { - net_sin(&result_addr)->sin_port = htons(port); - } - } + LOG_DBG("DNS RESULT: %s", log_strdup(net_addr_ntop(result.ai_family, diff --git a/drivers/timer/arcv2_timer0.c b/drivers/timer/arcv2_timer0.c index 3ca3a22ea642..21325280ef7d 100644 --- a/drivers/timer/arcv2_timer0.c +++ b/drivers/timer/arcv2_timer0.c @@ -67,7 +67,7 @@ static u32_t last_load; /* * This local variable holds the amount of timer cycles elapsed - * and it is updated in z_clock_isr() and z_clock_set_timeout(). + * and it is updated in z_timer_int_handler and z_clock_set_timeout(). * * Note: * At an arbitrary point in time the "current" value of the @@ -90,10 +90,10 @@ static u32_t announced_cycles; * in elapsed() function, as well as in the updates to cycle_count. * * Note: - * Each time cycle_count is updated with the value from overflow_cyc, - * the overflow_cyc must be reset to zero. + * Each time cycle_count is updated with the value from overflow_cycles, + * the overflow_cycles must be reset to zero. */ -static volatile u32_t overflow_cyc; +static volatile u32_t overflow_cycles; #endif /** @@ -168,13 +168,13 @@ static ALWAYS_INLINE void timer0_limit_register_set(u32_t count) * updated. 'cycle_count' may be updated either by the ISR, or * in z_clock_set_timeout(). * - * Additionally, the function updates the 'overflow_cyc' counter, that + * Additionally, the function updates the 'overflow_cycles' counter, that * holds the amount of elapsed HW cycles due to (possibly) multiple * timer wraps (overflows). * * Prerequisites: * - reprogramming of LIMIT must be clearing the COUNT - * - ISR must be clearing the 'overflow_cyc' counter. + * - ISR must be clearing the 'overflow_cycles' counter. * - no more than one counter-wrap has occurred between * - the timer reset or the last time the function was called * - and until the current call of the function is completed. @@ -190,13 +190,22 @@ static u32_t elapsed(void) } while (timer0_count_register_get() < val); if (ctrl & _ARC_V2_TMR_CTRL_IP) { - overflow_cyc += last_load; + overflow_cycles += last_load; /* clear the IP bit of the control register */ timer0_control_register_set(_ARC_V2_TMR_CTRL_NH | _ARC_V2_TMR_CTRL_IE); + /* use sw triggered irq to remember the timer irq request + * which may be cleared by the above operation. when elapsed () + * is called in z_timer_int_handler, no need to do this. + */ + if (!z_arc_v2_irq_unit_is_in_isr() || + z_arc_v2_aux_reg_read(_ARC_V2_ICAUSE) != IRQ_TIMER0) { + z_arc_v2_aux_reg_write(_ARC_V2_AUX_IRQ_HINT, + IRQ_TIMER0); + } } - return val + overflow_cyc; + return val + overflow_cycles; } #endif @@ -215,29 +224,43 @@ static void timer_int_handler(void *unused) ARG_UNUSED(unused); u32_t dticks; - #if defined(CONFIG_SMP) && CONFIG_MP_NUM_CPUS > 1 u64_t curr_time; k_spinlock_key_t key; + /* clear the IP bit of the control register */ + timer0_control_register_set(_ARC_V2_TMR_CTRL_NH | + _ARC_V2_TMR_CTRL_IE); key = k_spin_lock(&lock); /* gfrc is the wall clock */ curr_time = z_arc_connect_gfrc_read(); dticks = (curr_time - last_time) / CYC_PER_TICK; - last_time = curr_time; + /* last_time should be aligned to ticks */ + last_time += dticks * CYC_PER_TICK; k_spin_unlock(&lock, key); z_clock_announce(dticks); #else + /* timer_int_handler may be triggered by timer irq or + * software helper irq + */ + + /* irq with higher priority may call z_clock_set_timeout + * so need a lock here + */ + u32_t key; + + key = arch_irq_lock(); + elapsed(); - cycle_count += overflow_cyc; - overflow_cyc = 0; + cycle_count += overflow_cycles; + overflow_cycles = 0; + arch_irq_unlock(key); dticks = (cycle_count - announced_cycles) / CYC_PER_TICK; - announced_cycles += dticks * CYC_PER_TICK; z_clock_announce(TICKLESS ? dticks : 1); #endif @@ -270,18 +293,13 @@ int z_clock_driver_init(struct device *device) start_time = last_time; #else last_load = CYC_PER_TICK; - overflow_cyc = 0; + overflow_cycles = 0; announced_cycles = 0; IRQ_CONNECT(IRQ_TIMER0, CONFIG_ARCV2_TIMER_IRQ_PRIORITY, timer_int_handler, NULL, 0); timer0_limit_register_set(last_load - 1); - /* make timer irq pulse sensitive, and self-clear when it's handled - * then we can clear the IP bit of CTRL in non-interrupt context, - * without missing timer irq. - */ - z_arc_v2_irq_unit_sensitivity_set(IRQ_TIMER0, 1); #ifdef CONFIG_BOOT_TIME_MEASUREMENT cycle_count = timer0_count_register_get(); #endif @@ -321,8 +339,12 @@ void z_clock_set_timeout(s32_t ticks, bool idle) ticks = MIN(MAX_TICKS, ticks); - /* Desired delay in the future */ - delay = (ticks == 0) ? CYC_PER_TICK : ticks * CYC_PER_TICK; + /* Desired delay in the future + * use MIN_DEALY here can trigger the timer + * irq more soon, no need to go to CYC_PER_TICK + * later. + */ + delay = MAX(ticks * CYC_PER_TICK, MIN_DELAY); key = arch_irq_lock(); @@ -358,7 +380,7 @@ void z_clock_set_timeout(s32_t ticks, bool idle) * to loss */ timer0_count_register_set(0); - overflow_cyc = 0U; + overflow_cycles = 0U; /* normal case */ @@ -384,11 +406,7 @@ void z_clock_set_timeout(s32_t ticks, bool idle) delay -= unannounced; delay = MAX(delay, MIN_DELAY); - if (delay > MAX_CYCLES) { - last_load = MAX_CYCLES; - } else { - last_load = delay; - } + last_load = MIN(delay, MAX_CYCLES); } timer0_limit_register_set(last_load - 1); diff --git a/drivers/timer/nrf_rtc_timer.c b/drivers/timer/nrf_rtc_timer.c index 7c306ced503d..a4e0829619b3 100644 --- a/drivers/timer/nrf_rtc_timer.c +++ b/drivers/timer/nrf_rtc_timer.c @@ -14,6 +14,7 @@ #include #define RTC NRF_RTC1 +#define RTC_IRQn NRFX_IRQ_NUMBER_GET(RTC) #define COUNTER_SPAN BIT(24) #define COUNTER_MAX (COUNTER_SPAN - 1U) @@ -88,6 +89,11 @@ static void prevent_false_prev_evt(void) k_busy_wait(15); event_clear(); } + + /* Clear interrupt that may have fired as we were setting the + * comparator. + */ + NVIC_ClearPendingIRQ(RTC_IRQn); } /* If settings is next tick from now, function attempts to set next tick. If @@ -160,7 +166,7 @@ static void set_protected_absolute_ticks(u32_t ticks) * it by pointer at runtime, maybe?) so we don't have this leaky * symbol. */ -void rtc1_nrf_isr(void *arg) +void rtc_nrf_isr(void *arg) { ARG_UNUSED(arg); event_clear(); @@ -196,11 +202,11 @@ int z_clock_driver_init(struct device *device) /* TODO: replace with counter driver to access RTC */ nrf_rtc_prescaler_set(RTC, 0); event_clear(); - NVIC_ClearPendingIRQ(RTC1_IRQn); + NVIC_ClearPendingIRQ(RTC_IRQn); int_enable(); - IRQ_CONNECT(RTC1_IRQn, 1, rtc1_nrf_isr, 0, 0); - irq_enable(RTC1_IRQn); + IRQ_CONNECT(RTC_IRQn, 1, rtc_nrf_isr, 0, 0); + irq_enable(RTC_IRQn); nrf_rtc_task_trigger(RTC, NRF_RTC_TASK_CLEAR); nrf_rtc_task_trigger(RTC, NRF_RTC_TASK_START); diff --git a/drivers/usb/device/usb_dc_nrfx.c b/drivers/usb/device/usb_dc_nrfx.c index cb1fefee187d..e7cacf6e706f 100644 --- a/drivers/usb/device/usb_dc_nrfx.c +++ b/drivers/usb/device/usb_dc_nrfx.c @@ -1862,6 +1862,7 @@ int usb_dc_ep_read_continue(u8_t ep) struct usbd_event *ev = usbd_evt_alloc(); if (!ev) { + k_mutex_unlock(&ctx->drv_lock); return -ENOMEM; } diff --git a/dts/arm/broadcom/viper-a72.dtsi b/dts/arm/broadcom/viper-a72.dtsi index ad0624c8e1e2..11e00a33a3f0 100644 --- a/dts/arm/broadcom/viper-a72.dtsi +++ b/dts/arm/broadcom/viper-a72.dtsi @@ -35,14 +35,14 @@ arch_timer: timer { compatible = "arm,arm-timer"; interrupt-parent = <&gic>; - interrupts = , - , - , - ; + interrupts = , + , + , + ; label = "arch_timer"; }; @@ -51,12 +51,12 @@ &uart0 { interrupt-parent = <&gic>; - interrupts = ; + interrupts = ; }; &uart1 { interrupt-parent = <&gic>; - interrupts = ; + interrupts = ; }; diff --git a/dts/arm/nxp/nxp_k8x.dtsi b/dts/arm/nxp/nxp_k8x.dtsi index fa7b40077819..499f81bcff2b 100644 --- a/dts/arm/nxp/nxp_k8x.dtsi +++ b/dts/arm/nxp/nxp_k8x.dtsi @@ -94,6 +94,7 @@ interrupts = <39 0>; label = "ADC_0"; status = "disabled"; + #io-channel-cells = <1>; }; gpioa: gpio@400ff000 { diff --git a/dts/arm/nxp/nxp_kv5x.dtsi b/dts/arm/nxp/nxp_kv5x.dtsi index f8efc202a9ea..e14189e1e83c 100644 --- a/dts/arm/nxp/nxp_kv5x.dtsi +++ b/dts/arm/nxp/nxp_kv5x.dtsi @@ -88,6 +88,7 @@ interrupts = <37 0>; label = "ADC_0"; status = "disabled"; + #io-channel-cells = <1>; }; gpioa: gpio@400ff000 { diff --git a/dts/arm/qemu-virt/qemu-virt-a53.dtsi b/dts/arm/qemu-virt/qemu-virt-a53.dtsi index 8df45c64f3da..aa8ea4bb5b59 100644 --- a/dts/arm/qemu-virt/qemu-virt-a53.dtsi +++ b/dts/arm/qemu-virt/qemu-virt-a53.dtsi @@ -52,7 +52,7 @@ compatible = "arm,pl011"; reg = <0x9000000 0x1000>; status = "disabled"; - interrupts = ; + interrupts = ; interrupt-names = "irq_0"; clocks = <&uartclk>; label = "UART_0"; @@ -70,14 +70,14 @@ arch_timer: timer { compatible = "arm,arm-timer"; - interrupts = , - , - , - ; + interrupts = , + , + , + ; label = "arch_timer"; }; }; diff --git a/lib/updatehub/updatehub.c b/lib/updatehub/updatehub.c index ca798b1a1737..53e46425568a 100644 --- a/lib/updatehub/updatehub.c +++ b/lib/updatehub/updatehub.c @@ -21,19 +21,20 @@ LOG_MODULE_REGISTER(updatehub); #include #include #include -#include +#include #include "include/updatehub.h" #include "updatehub_priv.h" #include "updatehub_firmware.h" #include "updatehub_device.h" + #if defined(CONFIG_UPDATEHUB_DTLS) #define CA_CERTIFICATE_TAG 1 #include #endif -#define NETWORK_TIMEOUT (2 * MSEC_PER_SEC) +#define NETWORK_TIMEOUT K_SECONDS(2) #define UPDATEHUB_POLL_INTERVAL K_MINUTES(CONFIG_UPDATEHUB_POLL_INTERVAL) #define MAX_PATH_SIZE 255 /* MAX_PAYLOAD_SIZE must reflect size COAP_BLOCK_x option */ @@ -43,7 +44,7 @@ LOG_MODULE_REGISTER(updatehub); * otherwise download size will be less than real size. */ #define MAX_DOWNLOAD_DATA (MAX_PAYLOAD_SIZE + 32) -#define COAP_MAX_RETRY 3 +#define COAP_MAX_RETRY 10 /* increased to 10 from 3 due to wireless channel */ #define MAX_IP_SIZE 30 #define SHA256_HEX_DIGEST_SIZE ((TC_SHA256_DIGEST_SIZE * 2) + 1) @@ -54,6 +55,56 @@ LOG_MODULE_REGISTER(updatehub); #define UPDATEHUB_SERVER "coap.updatehub.io" #endif + +#define GET_NUM_2(v) ((v) >> 4) /* a define to get block number from block2 from the coap packet, please refer to coap.c for definition */ + +static int attempts_download; /* has been moved here so as to increase scope and be manageable in different functions */ +static int expected_block_num = 0; /* this variable helps detect duplicates so that memory slot 1 write operation is performed only once */ + + +static int get_block_option_1(const struct coap_packet *cpkt, u16_t code); +static int get_block_option_1(const struct coap_packet *cpkt, u16_t code) /* function to get block option 2 for CoAP, please refer to coap.c for implementation of this function */ +{ + struct coap_option option; + unsigned int val; + int count = 1; + + count = coap_find_options(cpkt, code, &option, count); + if (count <= 0) { + return -ENOENT; + } + + val = coap_option_value_to_int(&option); + + return val; + +} + +static int get_num_block(struct coap_packet *cpkt); /* function to get block number from COAP Block 2 fields, return block number */ + +static int get_num_block(struct coap_packet *cpkt){ + int block2 = get_block_option_1(cpkt, COAP_OPTION_BLOCK2); + if(block2) + return GET_NUM_2(block2); + return -ENOENT; +} + +static struct k_timer timer; /* timer to handle stop and wait protocol for GET requests. */ +bool is_transmission_allowed = true; /* variable to stop or allow transmission */ + +static void timer_expire(struct k_timer *timer){ + is_transmission_allowed = true; +} +/* no transmission is allowed when the timer is running + when timer has expired, timer is now ready for next transmission */ + +static void timer_stop(struct k_timer *timer){ /* manual stop */ + is_transmission_allowed = true; +} + +/* no transmission is allowed when the timer is running + when timer is stopped manually, when reply (CoAP data packet) arrives resulting in allowing next request transmission thus implementing Stop and Wait protocol.*/ + static struct updatehub_context { struct coap_block_context block; struct k_sem semaphore; @@ -154,6 +205,8 @@ static bool start_coap_client(void) int resolve_attempts = 10; int ret = -1; + memset(&hints, 0, sizeof(hints)); + if (IS_ENABLED(CONFIG_NET_IPV6)) { hints.ai_family = AF_INET6; hints.ai_socktype = SOCK_STREAM; @@ -378,18 +431,39 @@ static void install_update_cb(void) wait_fds(); rcvd = recv(ctx.sock, data, MAX_DOWNLOAD_DATA, MSG_DONTWAIT); + LOG_INF("received bytes: rcvd: %d",rcvd); if (rcvd <= 0) { ctx.code_status = UPDATEHUB_NETWORKING_ERROR; LOG_ERR("Could not receive data"); goto cleanup; } - + if (coap_packet_parse(&response_packet, data, rcvd, NULL, 0) < 0) { LOG_ERR("Invalid data received"); ctx.code_status = UPDATEHUB_DOWNLOAD_ERROR; goto cleanup; } + + + /* check for the duplicate packet based upon block number if duplicate discard the packet otherwise process it and adjust the timer + */ + int block_num = get_num_block(&response_packet); /* calculate the block number of incoming coap data packet */ + if ((response_packet.max_len - response_packet.offset) <= 0 || (block_num < 0)){ /* ignore the rubbish packets */ + LOG_ERR("Invalid data received or block number is < 0"); + ctx.code_status = UPDATEHUB_OK; /* It is still okay to receive further packets */ + goto cleanup; + } + if(block_num == expected_block_num){ + expected_block_num ++; + } + else{ + goto cleanup; /* duplicate and ignore the packet */ + } + + k_timer_stop(&timer); /* correct packet is received so stop the timer and allow further transmission */ + is_transmission_allowed = true; /* transmission is now allowed */ + attempts_download = 0; /* reset the retransmission counter */ ctx.downloaded_size = ctx.downloaded_size + (response_packet.max_len - response_packet.offset); @@ -400,14 +474,29 @@ static void install_update_cb(void) ctx.code_status = UPDATEHUB_DOWNLOAD_ERROR; goto cleanup; } - - if (flash_img_buffered_write(&ctx.flash_ctx, - response_packet.data + response_packet.offset, - response_packet.max_len - response_packet.offset, - ctx.downloaded_size == ctx.block.total_size) < 0) { - LOG_ERR("Error to write on the flash"); - ctx.code_status = UPDATEHUB_INSTALL_ERROR; - goto cleanup; + + if ((response_packet.max_len - response_packet.offset) < CONFIG_IMG_BLOCK_BUF_SIZE) { /* fix for zephyr-2.3-rc1 for STM32 series MCU as size of data write should be multiple of 8 this fix is tested for COAP_BLOCK_SIZE = 512 */ + (void)memset(response_packet.data + response_packet.offset+ (response_packet.max_len - response_packet.offset), 0xFF, + CONFIG_IMG_BLOCK_BUF_SIZE - (response_packet.max_len - response_packet.offset)); + + if (flash_img_buffered_write(&ctx.flash_ctx, + response_packet.data + response_packet.offset, + CONFIG_IMG_BLOCK_BUF_SIZE, + ctx.downloaded_size == ctx.block.total_size) < 0) { + LOG_ERR("Error to write on the flash"); + ctx.code_status = UPDATEHUB_INSTALL_ERROR; + goto cleanup; + } + } + else{ /* If incoming packet size is 512 */ + if (flash_img_buffered_write(&ctx.flash_ctx, + response_packet.data + response_packet.offset, + response_packet.max_len - response_packet.offset, + ctx.downloaded_size == ctx.block.total_size) < 0) { + LOG_ERR("Error to write on the flash"); + ctx.code_status = UPDATEHUB_INSTALL_ERROR; + goto cleanup; + } } if (coap_update_from_block(&response_packet, &ctx.block) < 0) { @@ -429,17 +518,16 @@ static void install_update_cb(void) goto cleanup; } } - + ctx.code_status = UPDATEHUB_OK; - + cleanup: k_free(data); } static enum updatehub_response install_update(void) { - int verification_download = 0; - int attempts_download = 0; + k_timer_init(&timer, timer_expire,timer_stop); /* initialize the timer for stop and wait for GET Requests */ if (boot_erase_img_bank(FLASH_AREA_ID(image_1)) != 0) { LOG_ERR("Failed to init flash and erase second slot"); @@ -458,9 +546,9 @@ static enum updatehub_response install_update(void) goto error; } - if (coap_block_transfer_init(&ctx.block, COAP_BLOCK_1024, + if (coap_block_transfer_init(&ctx.block, COAP_BLOCK_512, update_info.image_size) < 0) { - LOG_ERR("Unable init block transfer"); + LOG_ERR("Unable init block transfer"); /* here block size is reduced to 512 Bytes (COAP_BLOCK_512) due to the reason that modem has limitation of 1024 bytes so we want packets intact*/ ctx.code_status = UPDATEHUB_NETWORKING_ERROR; goto cleanup; } @@ -470,28 +558,32 @@ static enum updatehub_response install_update(void) ctx.downloaded_size = 0; while (ctx.downloaded_size != ctx.block.total_size) { - verification_download = ctx.downloaded_size; - - if (send_request(COAP_TYPE_CON, COAP_METHOD_GET, - UPDATEHUB_DOWNLOAD) < 0) { - ctx.code_status = UPDATEHUB_NETWORKING_ERROR; - goto cleanup; - } + if(is_transmission_allowed){ /* no transmission is allowed if the reply (data packet) is not received before timeout + going to send the request */ + if (send_request(COAP_TYPE_CON, COAP_METHOD_GET, + UPDATEHUB_DOWNLOAD) < 0) { + ctx.code_status = UPDATEHUB_NETWORKING_ERROR; + goto cleanup; + } + is_transmission_allowed = false; /* stop transmission window unless released by timeout or successful reception of coap block*/ + k_timer_start(&timer, K_SECONDS(4), 0); /* adjust the delay, 4s is taken as a good estimate for now considering also modem */ + attempts_download++; /* this targets stop and wait mechanism, each transmission increases this counter unless reset by successful reception of data packet */ + } - install_update_cb(); + install_update_cb(); - if (ctx.code_status != UPDATEHUB_OK) { + if(ctx.code_status == UPDATEHUB_DOWNLOAD_ERROR){ /* if some error packets from the server are received then stop the transfer */ + LOG_ERR("install_update(): download is not successful \n"); goto cleanup; } - if (verification_download == ctx.downloaded_size) { - if (attempts_download == COAP_MAX_RETRY) { - LOG_ERR("Could not get the packet"); - ctx.code_status = UPDATEHUB_DOWNLOAD_ERROR; - goto cleanup; - } - attempts_download++; + if (attempts_download == COAP_MAX_RETRY) { + LOG_ERR("Could not get the packet"); + ctx.code_status = UPDATEHUB_DOWNLOAD_ERROR; + goto cleanup; } +/* "attempts_download" is now handled by retransmission counter contrary to Fixed LAN scheme */ +/* now the check is on attempts_download rather than verification_download etc. */ } cleanup: @@ -585,7 +677,7 @@ static int report(enum updatehub_state state) k_free(firmware_version); k_free(device_id); - return ret; + return ret; } static void probe_cb(char *metadata, size_t metadata_size) @@ -609,7 +701,6 @@ static void probe_cb(char *metadata, size_t metadata_size) ctx.code_status = UPDATEHUB_DOWNLOAD_ERROR; return; } - if (COAP_RESPONSE_CODE_NOT_FOUND == coap_header_get_code(&reply)) { LOG_INF("No update available"); ctx.code_status = UPDATEHUB_NO_UPDATE; @@ -622,7 +713,6 @@ static void probe_cb(char *metadata, size_t metadata_size) ctx.code_status = UPDATEHUB_METADATA_ERROR; return; } - memcpy(metadata, reply.data + reply.offset, reply.max_len - reply.offset); @@ -638,7 +728,7 @@ static void probe_cb(char *metadata, size_t metadata_size) ctx.code_status = UPDATEHUB_OK; - LOG_INF("Probe metadata received"); + LOG_INF("Probe metadata received"); } enum updatehub_response updatehub_probe(void) @@ -697,12 +787,12 @@ enum updatehub_response updatehub_probe(void) ctx.code_status = UPDATEHUB_NETWORKING_ERROR; goto error; } - + if (send_request(COAP_TYPE_CON, COAP_METHOD_POST, UPDATEHUB_PROBE) < 0) { ctx.code_status = UPDATEHUB_NETWORKING_ERROR; goto cleanup; } - + memset(metadata,0,MAX_DOWNLOAD_DATA); probe_cb(metadata, MAX_DOWNLOAD_DATA); if (ctx.code_status != UPDATEHUB_OK) { @@ -715,13 +805,11 @@ enum updatehub_response updatehub_probe(void) ctx.code_status = UPDATEHUB_METADATA_ERROR; goto cleanup; } - memcpy(metadata_copy, metadata, strlen(metadata)); if (json_obj_parse(metadata, strlen(metadata), recv_probe_sh_array_descr, ARRAY_SIZE(recv_probe_sh_array_descr), &metadata_some_boards) < 0) { - if (json_obj_parse(metadata_copy, strlen(metadata_copy), recv_probe_sh_string_descr, ARRAY_SIZE(recv_probe_sh_string_descr), @@ -730,7 +818,6 @@ enum updatehub_response updatehub_probe(void) ctx.code_status = UPDATEHUB_METADATA_ERROR; goto cleanup; } - sha256size = strlen( metadata_any_boards.objects[1].objects.sha256sum) + 1; @@ -751,23 +838,19 @@ enum updatehub_response updatehub_probe(void) UPDATEHUB_INCOMPATIBLE_HARDWARE; goto cleanup; } - sha256size = strlen( - metadata_any_boards.objects[1].objects.sha256sum) + 1; - + metadata_some_boards.objects[1].objects.sha256sum) + 1; /* fixes the issue #24853 replace metadata_any_boards by metadata_some_boards */ if (sha256size != SHA256_HEX_DIGEST_SIZE) { LOG_ERR("SHA256 size is invalid"); ctx.code_status = UPDATEHUB_METADATA_ERROR; goto cleanup; } - memcpy(update_info.sha256sum_image, metadata_some_boards.objects[1].objects.sha256sum, SHA256_HEX_DIGEST_SIZE); update_info.image_size = metadata_some_boards.objects[1].objects.size; } - ctx.code_status = UPDATEHUB_HAS_UPDATE; cleanup: @@ -870,3 +953,4 @@ void updatehub_autohandler(void) k_delayed_work_init(&updatehub_work_handle, autohandler); k_delayed_work_submit(&updatehub_work_handle, K_NO_WAIT); } + diff --git a/lib/updatehub/updatehub_device.c b/lib/updatehub/updatehub_device.c index 611720ef7e16..2052cc54e978 100644 --- a/lib/updatehub/updatehub_device.c +++ b/lib/updatehub/updatehub_device.c @@ -4,8 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ #include "updatehub_device.h" - -#include + #include bool updatehub_get_device_identity(char *id, int id_max_len) { diff --git a/lib/updatehub/updatehub_firmware.c b/lib/updatehub/updatehub_firmware.c index 553f51654249..280917736db3 100644 --- a/lib/updatehub/updatehub_firmware.c +++ b/lib/updatehub/updatehub_firmware.c @@ -4,9 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include - #include "updatehub_firmware.h" + #include bool updatehub_get_firmware_version(char *version, int version_len) { diff --git a/samples/subsys/usb/audio/headphones_microphone/app.overlay b/samples/subsys/usb/audio/headphones_microphone/boards/nrf52840dk_nrf52840.overlay similarity index 100% rename from samples/subsys/usb/audio/headphones_microphone/app.overlay rename to samples/subsys/usb/audio/headphones_microphone/boards/nrf52840dk_nrf52840.overlay diff --git a/samples/subsys/usb/audio/headphones_microphone/sample.yaml b/samples/subsys/usb/audio/headphones_microphone/sample.yaml index 4fdb85b28d0a..ea32cf7713d1 100644 --- a/samples/subsys/usb/audio/headphones_microphone/sample.yaml +++ b/samples/subsys/usb/audio/headphones_microphone/sample.yaml @@ -1,2 +1,7 @@ sample: - name: USB audio sample + name: USB audio Headphones Microphone sample +tests: + sample.usb.audio.headphones_microphone: + depends_on: usb_device + tags: usb + platform_whitelist: nrf52840dk_nrf52840 diff --git a/samples/subsys/usb/audio/headset/app.overlay b/samples/subsys/usb/audio/headset/boards/nrf52840dk_nrf52840.overlay similarity index 100% rename from samples/subsys/usb/audio/headset/app.overlay rename to samples/subsys/usb/audio/headset/boards/nrf52840dk_nrf52840.overlay diff --git a/samples/subsys/usb/audio/headset/sample.yaml b/samples/subsys/usb/audio/headset/sample.yaml index 4fdb85b28d0a..6a99b17145ac 100644 --- a/samples/subsys/usb/audio/headset/sample.yaml +++ b/samples/subsys/usb/audio/headset/sample.yaml @@ -1,2 +1,7 @@ sample: - name: USB audio sample + name: USB audio headset sample +tests: + sample.usb.audio.headset: + depends_on: usb_device + tags: usb + platform_whitelist: nrf52840dk_nrf52840 diff --git a/scripts/gen_offset_header.py b/scripts/gen_offset_header.py index 82152fbb42fc..11cb7227f78d 100755 --- a/scripts/gen_offset_header.py +++ b/scripts/gen_offset_header.py @@ -61,6 +61,7 @@ def gen_offset_header(input_name, input_file, output_file): if __name__ == '__main__': parser = argparse.ArgumentParser( + description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument( diff --git a/scripts/net/run-sample-tests.sh b/scripts/net/run-sample-tests.sh index c9c0448393c9..470f834144ba 100755 --- a/scripts/net/run-sample-tests.sh +++ b/scripts/net/run-sample-tests.sh @@ -21,9 +21,7 @@ check_dirs () then echo '$ZEPHYR_BASE is unset' >&2 ret_zephyr=1 - fi - - if [ ! -d "$ZEPHYR_BASE" ] + elif [ ! -d "$ZEPHYR_BASE" ] then echo '$ZEPHYR_BASE is set, but it is not a directory' >&2 ret_zephyr=1 @@ -55,9 +53,7 @@ check_dirs () then echo '$NET_TOOLS_BASE is unset, no net-tools found' >&2 ret_net_tools=1 - fi - - if [ ! -d "$NET_TOOLS_BASE" ] + elif [ ! -d "$NET_TOOLS_BASE" ] then echo '$NET_TOOLS_BASE set, but it is not a directory' >&2 ret_net_tools=1 diff --git a/soc/arc/snps_emsdp/Kconfig.defconfig b/soc/arc/snps_emsdp/Kconfig.defconfig index 9daa4081a47a..0e04f92315ac 100644 --- a/soc/arc/snps_emsdp/Kconfig.defconfig +++ b/soc/arc/snps_emsdp/Kconfig.defconfig @@ -11,10 +11,6 @@ config NUM_IRQ_PRIO_LEVELS # 0 for Fast Interrupts (FIRQs) and 1-3 for Regular Interrupts (IRQs). default 4 -config NUM_IRQS - # must be > the highest interrupt number used - default 128 - source "soc/arc/snps_emsdp/Kconfig.defconfig.em4" source "soc/arc/snps_emsdp/Kconfig.defconfig.em5d" source "soc/arc/snps_emsdp/Kconfig.defconfig.em6" diff --git a/soc/arc/snps_emsdp/Kconfig.defconfig.em11d b/soc/arc/snps_emsdp/Kconfig.defconfig.em11d index d87d0fce71fd..4cbba3ac381d 100644 --- a/soc/arc/snps_emsdp/Kconfig.defconfig.em11d +++ b/soc/arc/snps_emsdp/Kconfig.defconfig.em11d @@ -37,4 +37,7 @@ config ZTEST_STACKSIZE default 2048 depends on ZTEST +config NUM_IRQS + default 111 + endif # SOC_EMSDP_EM11D diff --git a/soc/arc/snps_emsdp/Kconfig.defconfig.em4 b/soc/arc/snps_emsdp/Kconfig.defconfig.em4 index 31559f2abe4b..c17b918950bd 100644 --- a/soc/arc/snps_emsdp/Kconfig.defconfig.em4 +++ b/soc/arc/snps_emsdp/Kconfig.defconfig.em4 @@ -37,4 +37,7 @@ config ZTEST_STACKSIZE default 2048 depends on ZTEST +config NUM_IRQS + default 113 + endif # SOC_EMSDP_EM4 diff --git a/soc/arc/snps_emsdp/Kconfig.defconfig.em5d b/soc/arc/snps_emsdp/Kconfig.defconfig.em5d index 14dd54029f00..6f09508a277e 100644 --- a/soc/arc/snps_emsdp/Kconfig.defconfig.em5d +++ b/soc/arc/snps_emsdp/Kconfig.defconfig.em5d @@ -37,4 +37,7 @@ config ZTEST_STACKSIZE default 2048 depends on ZTEST +config NUM_IRQS + default 111 + endif # SOC_EMSDP_EM5D diff --git a/soc/arc/snps_emsdp/Kconfig.defconfig.em6 b/soc/arc/snps_emsdp/Kconfig.defconfig.em6 index 2270e7cde3bf..e51b63a110d8 100644 --- a/soc/arc/snps_emsdp/Kconfig.defconfig.em6 +++ b/soc/arc/snps_emsdp/Kconfig.defconfig.em6 @@ -37,4 +37,7 @@ config ZTEST_STACKSIZE default 2048 depends on ZTEST +config NUM_IRQS + default 113 + endif # SOC_EMSDP_EM6 diff --git a/soc/arc/snps_emsdp/Kconfig.defconfig.em7d b/soc/arc/snps_emsdp/Kconfig.defconfig.em7d index 161d47da47a3..a8966196037f 100644 --- a/soc/arc/snps_emsdp/Kconfig.defconfig.em7d +++ b/soc/arc/snps_emsdp/Kconfig.defconfig.em7d @@ -37,4 +37,7 @@ config ZTEST_STACKSIZE default 2048 depends on ZTEST +config NUM_IRQS + default 111 + endif # SOC_EMSDP_EM7D diff --git a/soc/arc/snps_emsdp/Kconfig.defconfig.em7d_esp b/soc/arc/snps_emsdp/Kconfig.defconfig.em7d_esp index 03013b5020ee..c83d2dfda43a 100644 --- a/soc/arc/snps_emsdp/Kconfig.defconfig.em7d_esp +++ b/soc/arc/snps_emsdp/Kconfig.defconfig.em7d_esp @@ -27,4 +27,7 @@ config CACHE_FLUSHING config FP_FPU_DA default y +config NUM_IRQS + default 112 + endif # SOC_EMSDP_EM7D_ESP diff --git a/soc/arc/snps_emsdp/Kconfig.defconfig.em9d b/soc/arc/snps_emsdp/Kconfig.defconfig.em9d index 8d168ae30ed8..cd702b780bf8 100644 --- a/soc/arc/snps_emsdp/Kconfig.defconfig.em9d +++ b/soc/arc/snps_emsdp/Kconfig.defconfig.em9d @@ -37,4 +37,7 @@ config ZTEST_STACKSIZE default 2048 depends on ZTEST +config NUM_IRQS + default 111 + endif # SOC_EMSDP_EM9D diff --git a/subsys/settings/src/settings_fcb.c b/subsys/settings/src/settings_fcb.c index 1a35c36bbaa5..a3d5d3a39009 100644 --- a/subsys/settings/src/settings_fcb.c +++ b/subsys/settings/src/settings_fcb.c @@ -317,12 +317,16 @@ static int settings_fcb_save_priv(struct settings_store *cs, const char *name, wbs = cf->cf_fcb.f_align; len = settings_line_len_calc(name, val_len); - for (i = 0; i < cf->cf_fcb.f_sector_cnt - 1; i++) { + for (i = 0; i < cf->cf_fcb.f_sector_cnt; i++) { rc = fcb_append(&cf->cf_fcb, len, &loc.loc); if (rc != -ENOSPC) { break; } - settings_fcb_compress(cf); + + /* FCB can compress up to cf->cf_fcb.f_sector_cnt - 1 times. */ + if (i < (cf->cf_fcb.f_sector_cnt - 1)) { + settings_fcb_compress(cf); + } } if (rc) { return -EINVAL; diff --git a/subsys/tracing/cpu_stats.c b/subsys/tracing/cpu_stats.c index ba9ee044f0f3..cba4af11f8fd 100644 --- a/subsys/tracing/cpu_stats.c +++ b/subsys/tracing/cpu_stats.c @@ -160,14 +160,14 @@ static void cpu_stats_log_fn(struct k_work *item) cpu_stats_display(); cpu_stats_reset_counters(); k_delayed_work_submit(&cpu_stats_log, - CONFIG_TRACING_CPU_STATS_INTERVAL); + K_MSEC(CONFIG_TRACING_CPU_STATS_INTERVAL)); } static int cpu_stats_log_init(struct device *dev) { k_delayed_work_init(&cpu_stats_log, cpu_stats_log_fn); k_delayed_work_submit(&cpu_stats_log, - CONFIG_TRACING_CPU_STATS_INTERVAL); + K_MSEC(CONFIG_TRACING_CPU_STATS_INTERVAL)); return 0; } diff --git a/tests/arch/arm/arm_irq_vector_table/src/arm_irq_vector_table.c b/tests/arch/arm/arm_irq_vector_table/src/arm_irq_vector_table.c index ad9a82f63e84..81c509050997 100644 --- a/tests/arch/arm/arm_irq_vector_table/src/arm_irq_vector_table.c +++ b/tests/arch/arm/arm_irq_vector_table/src/arm_irq_vector_table.c @@ -185,7 +185,7 @@ typedef void (*vth)(void); /* Vector Table Handler */ * * Note: qemu_cortex_m0 uses TIMER0 to implement system timer. */ -void rtc1_nrf_isr(void); +void rtc_nrf_isr(void); void nrf_power_clock_isr(void); #if defined(CONFIG_SOC_SERIES_NRF51X) || defined(CONFIG_SOC_SERIES_NRF52X) #if defined(CONFIG_BOARD_QEMU_CORTEX_M0) @@ -198,7 +198,7 @@ vth __irq_vector_table _irq_vector_table[] = { nrf_power_clock_isr, isr0, isr1, isr2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - rtc1_nrf_isr + rtc_nrf_isr }; #endif /* CONFIG_BOARD_QEMU_CORTEX_M0 */ #elif defined(CONFIG_SOC_SERIES_NRF53X) || defined(CONFIG_SOC_SERIES_NRF91X) @@ -207,14 +207,14 @@ vth __irq_vector_table _irq_vector_table[] = { 0, 0, 0, 0, 0, nrf_power_clock_isr, 0, 0, isr0, isr1, isr2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - rtc1_nrf_isr + rtc_nrf_isr }; #else vth __irq_vector_table _irq_vector_table[] = { 0, 0, 0, 0, 0, nrf_power_clock_isr, 0, 0, isr0, isr1, isr2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - rtc1_nrf_isr + rtc_nrf_isr }; #endif #endif diff --git a/tests/drivers/adc/adc_api/src/test_adc.c b/tests/drivers/adc/adc_api/src/test_adc.c index d91f08094200..0a21c0529cd0 100644 --- a/tests/drivers/adc/adc_api/src/test_adc.c +++ b/tests/drivers/adc/adc_api/src/test_adc.c @@ -80,6 +80,15 @@ #define ADC_ACQUISITION_TIME ADC_ACQ_TIME_DEFAULT #define ADC_1ST_CHANNEL_ID 14 +#elif defined(CONFIG_BOARD_FRDM_K82F) + +#define ADC_DEVICE_NAME DT_LABEL(DT_INST(0, nxp_kinetis_adc16)) +#define ADC_RESOLUTION 12 +#define ADC_GAIN ADC_GAIN_1 +#define ADC_REFERENCE ADC_REF_INTERNAL +#define ADC_ACQUISITION_TIME ADC_ACQ_TIME_DEFAULT +#define ADC_1ST_CHANNEL_ID 15 + #elif defined(CONFIG_BOARD_FRDM_KL25Z) #define ADC_DEVICE_NAME DT_LABEL(DT_INST(0, nxp_kinetis_adc16)) diff --git a/tests/kernel/gen_isr_table/src/main.c b/tests/kernel/gen_isr_table/src/main.c index 7b0c84123686..bd353c538a2e 100644 --- a/tests/kernel/gen_isr_table/src/main.c +++ b/tests/kernel/gen_isr_table/src/main.c @@ -32,6 +32,14 @@ extern u32_t _irq_vector_table[]; #define ISR5_OFFSET 4 #define ISR6_OFFSET 5 +#if defined(CONFIG_SOC_ARC_EMSDP) +/* ARC EMSDP' console will use irq 108 / irq 107, will conflict + * with isr used here, so add a workaround + */ +#undef CONFIG_NUM_IRQS +#define CONFIG_NUM_IRQS 105 +#endif + #define IRQ_LINE(offset) (CONFIG_NUM_IRQS - ((offset) + 1)) #define TABLE_INDEX(offset) (IRQ_TABLE_SIZE - ((offset) + 1)) #define TRIG_CHECK_SIZE 6