Skip to content

Commit

Permalink
[Telink] Add DFU via USB for Mars board
Browse files Browse the repository at this point in the history
  • Loading branch information
serhiiSalamakha committed Oct 25, 2023
1 parent bc858f6 commit 917f88e
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 10 deletions.
12 changes: 11 additions & 1 deletion config/telink/chip-module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,16 @@ else()
unset(USB_BOOT_DTC_OVERLAY_FILE)
endif()

if(${TLNK_MARS_BOARD} MATCHES y)
if(EXISTS "${CHIP_ROOT}/src/platform/telink/${BOARD}_mars_boot.overlay")
set(MARS_BOOT_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}_mars_boot.overlay")
else()
unset(MARS_BOOT_DTC_OVERLAY_FILE)
endif()
else()
unset(MARS_CONF_OVERLAY_FILE)
endif()

if(EXISTS "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay")
set(GLOBAL_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${BOARD}.overlay")
else()
Expand Down Expand Up @@ -185,7 +195,7 @@ if (CONFIG_BOOTLOADER_MCUBOOT)
add_custom_target(build_mcuboot ALL
COMMAND
west build -b ${BOARD} -d build_mcuboot ${ZEPHYR_BASE}/../bootloader/mcuboot/boot/zephyr
-- -DOVERLAY_CONFIG=${GLOBAL_BOOTLOADER_CONF_OVERLAY_FILE} -DDTC_OVERLAY_FILE="${GLOBAL_DTC_OVERLAY_FILE};${FLASH_DTC_OVERLAY_FILE};${USB_BOOT_DTC_OVERLAY_FILE}"
-- -DOVERLAY_CONFIG=${GLOBAL_BOOTLOADER_CONF_OVERLAY_FILE} -DDTC_OVERLAY_FILE="${GLOBAL_DTC_OVERLAY_FILE};${FLASH_DTC_OVERLAY_FILE};${USB_BOOT_DTC_OVERLAY_FILE};${MARS_BOOT_DTC_OVERLAY_FILE}"
COMMAND
cp ${PROJECT_BINARY_DIR}/../modules/chip-module/build_mcuboot/zephyr/zephyr.bin ${PROJECT_BINARY_DIR}/zephyr.mcuboot.bin
)
Expand Down
5 changes: 4 additions & 1 deletion src/platform/telink/tlsr9518adk80d_mars.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
CONFIG_CHIP_USE_MARS_SENSOR=y
CONFIG_CHIP_BUTTON_MANAGER_IRQ_MODE=y
CONFIG_I2C=y
CONFIG_SENSOR=y
CONFIG_SENSOR=y
CONFIG_USB_DEVICE_STACK=y
CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n
CONFIG_USB_CDC_ACM_LOG_LEVEL_OFF=y
12 changes: 4 additions & 8 deletions src/platform/telink/tlsr9518adk80d_mars.overlay
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
/ {
leds {
/delete-node/ led_3;

led_red: led_3 {
gpios = <&gpiob 6 GPIO_ACTIVE_HIGH>;
label = "LED Red";
gpios = <&gpiob 6 GPIO_ACTIVE_HIGH>;
};
};

keys {
/delete-node/ button_1;
/delete-node/ button_3;
/delete-node/ button_4;
compatible = "gpio-keys";
key_1: button_1 {
gpios = <&gpiod 2 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};
key_2: button_2 {
gpios = <&gpiod 1 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};
key_3: button_3 {
gpios = <&gpioc 1 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};
key_4: button_4 {
gpios = <&gpiod 3 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};
Expand Down
28 changes: 28 additions & 0 deletions src/platform/telink/tlsr9518adk80d_mars_boot.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/ {
leds {
/delete-node/ led_0;

led_blue: led_0 {
label = "LED Blue";
gpios = <&gpiob 6 GPIO_ACTIVE_HIGH>;
};
};

keys {
/delete-node/ button_dfu;

key_dfu: button_dfu {
label = "USB DFU";
gpios = <&gpiod 2 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
};
};
};

&gpioc {
interrupts = <38 1>;
};

&gpiod {
interrupts = <37 1>;
status = "okay";
};

0 comments on commit 917f88e

Please sign in to comment.