Commit Graph

23 Commits

Author SHA1 Message Date
Johann Fischer a6e1e9e339 zephyr: get CDC ACM UART device from devicetree
Adapt to Zephyr OS changes to get CDC ACM UART device.
Remove RECOVERY_UART_DEV_NAME Kconfig option and
use DEVICE_DT_GET() in serial_adapter.c

Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
2021-08-27 15:21:39 +02:00
Carlos Falgueras García a4b4b0f0a9 bootutil: Refactor MCUBOOT_LOG_MODULE_(DECLARE|REGISTER) macros
The "MCUBOOT_LOG_MODULE_(DECLARE|REGISTER)" macros should have a name
coherent with the rest of the logs macors, ie "BOOT_LOG_*". Also,
"bootutil_log.h" should define them as empty when the logs are disabled and
as "MCUBOOT_LOG_MODULE_*" when they are not.

With this change, the mcuboot user doesn't have to define
MCUBOOT_LOG_MODULE_* macros if the logs don't going to be used.

Signed-off-by: Carlos Falgueras García <carlos.falgueras@wslw.es>
2021-07-21 11:47:58 +02:00
Carles Cufi 55918edc66 zephyr: serial: Remove unnecessary call to irq_unlock
The following commit in Zephyr removed the need to unlock interrupts
when booting in single-threaded mode:
3b89cf173b

Remove the now obsolete lines.

Fixes #302.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2021-05-20 16:20:49 +02:00
Dominik Ermel 1422b4b8c8 zephyr: Fix serial recovery compilation warnings
Missing const on pointers to device structures caused compilation
warnings when compiling bootloader with serial recovery enabled.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2020-09-11 15:40:55 +02:00
Carles Cufi 1cb076c247 zephyr: serial: Align with new callback signature
Align the code to the new UART callback signature, see:

https://github.com/zephyrproject-rtos/zephyr/pull/26426

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2020-07-31 12:14:17 -03:00
Kumar Gala 0813efeac6 zephyr: Convert from Zephyr to C99 types
Use C99 types in favor of the Zephyr defined types.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-04 08:28:35 -06:00
Andrzej Puzdrowski 3f092bd313 zephyr: allow recovery over usb cdc-acm with logs enabled
Modified serial_adapter so log are allowed when using USB
CDC ACM serial port emulation.

Added dedicated thread for log processing of the highest application
priority. This allows to transmit all logs without adding k_sleep
anywhere else int the code.

Introduced boot log thread is simpler than the default log threat
which decreases flash footprint by a few dozen bytes.
Added configuration for nrf52840_pca10056 which shows how
to enable looging along with USB - among other, thread log
processing is required.

build command (form zephyr-project root directory)
west build -d build/mcuboot/nrf52840_pca10056 -b nrf52840_pca10056
./bootloader/mcuboot/boot/zephyr/
 -- -DDTC_OVERLAY_FILE=./boards/nrf52840_pca10056_big.overlay
-DOVERLAY_CONFIG=./usb_cdc_acm_log_recovery.conf

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-02-27 10:01:25 +01:00
Andrzej Puzdrowski ac1f1fff50 zephyr: enable usb by the application
Since zephyrproject-rtos/zephyr#20375
Need to enable USB by the application.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2020-02-05 12:49:05 +01:00
Peter Bigot 54c1e3fb6b zephyr: fix driver include paths
Zephyr will soon no longer add the drivers subdirectory of the include
hierarchy to the search path, so references to driver headers must
include the drivers/ prefix.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-01-25 10:01:42 -03:00
Andrzej Puzdrowski f000480409 zephyr/serial_recovery: fix serial device binding
zephyr changes the way in which it provide name of
serial device used by serial recover.
see: https://github.com/zephyrproject-rtos/zephyr/pull/18752

This path introduce build time configuration of device name
which is set to exact the same device which was set before.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-10-11 12:11:59 +02:00
Filip Kubicz db6be2d118 boot: zephyr: Update USB CDC ACM device name
Follow the device name changes in Zephyr.

Signed-off-by: Filip Kubicz <filip.kubicz@nordicsemi.no>
2019-05-22 15:18:34 +02:00
Andrzej Puzdrowski b26a4a9c40 zephyr: align uart device name
Zephyr changed way of generation UART device name label
which implies device name label text change.

Patch aligns the code to above change.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-02-27 12:51:04 +01:00
Andrzej Puzdrowski 0cd178d0e9 zephyr: fix build with zephyr
zephyr macro min() was hanged to MIN()
Kconfig key CDC_ACM_PORT_NAME was changed to CDC_ACM_PORT_NAME_0

zephyr sha of the fixing time is 406dc2cb0e2868392f444677ace416440695829f.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-02-22 10:36:41 +01:00
Emanuele Di Santo 9f1933d1a5 boot: zephyr: migrate to new log subystem
The old log subsystem has been deprecated in Zephyr.
Migrate to the new subsystem to avoid compilation warnings.

In-place log processing is selected as it is required as MCUBoot is
one thread application.

Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2019-01-10 19:11:15 +01:00
Emanuele Di Santo c4bf78009c zephyr: selectable serial device for recovery
This commit adds a choice for the device to use for serial recovery.

Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>

fixup
2018-10-30 18:17:23 +01:00
Emanuele Di Santo d1fd3f92b7 zephyr: fix serial ISR in serial_adapter
The UART device ISR in serial_adapter expected the device
to fire an interrupt for each byte that was received.
Although this might have worked for some devices it wouldn't
work for USB. This commit fixed the issue by modifying the ISR
according to the uart.h documentation.

Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
2018-08-04 09:13:23 -03:00
Carles Cufi 6400f0bf97 zephyr: serial_adapter: Cleanup queue variables
Remove the simple pointers and use the "&" operator throughout to
simplify the understanding of the code.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-07-18 07:03:45 -03:00
Carles Cufi b124e39f79 zephyr: serial_adapter: Fix allocation of buffers
In order to avoid overwriting an existing allocated buffer that has not
yet been processed by the main loop, switch to a new command buffer
whenever we have received a complete one.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-07-18 07:03:45 -03:00
Andrzej Puzdrowski 3011714194 zephyr: serial_adapter: preserve buffer list against lock
It was possible that free_queue locks on the self referencing
node.
This patch introduce check for this issue

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-06-20 16:08:58 +02:00
Carles Cufi 5e48c55df9 zephyr: Enable interrupts unconditionally
Due to an issue described here:
https://github.com/zephyrproject-rtos/zephyr/issues/8393
interrupts are not enabled when multithreading is disabled.
Enable interrupts to allow the serial recovery mode UART to receive
characters.

Note: This commit must be reverted once the issue is addressed.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-06-20 16:08:58 +02:00
Carles Cufi 5ceeddb413 zephyr: Use sys_slist instead of k_fifo in serial adapter
The k_fifo_* primitives are not available when multithreading is
disabled. Use sys_slist_* instead.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-06-20 16:08:58 +02:00
Marko Kiiskila c427af2e7e zephyr/serial_adapter; no need to inject \r on \n anymore.
boot_serial; syscfg tabs to spaces.

Signed-off-by: Marko Kiiskila <marko@runtime.io>
2018-06-14 23:19:06 +03:00
Andrzej Puzdrowski f6f652e204 Add serial adapter module for support serial communication for zephyr
Serial adapter uses the zephyr UART driver in interrupt mode for
providing communication capabilities needed for the boot serial
recovery mode.
This module provide API similar to mynewt console module.

Serial adapter module can not be compiled along with
the zephyr uart console module so this case is checked.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2017-12-06 16:11:10 -07:00