Skip to content

Commit a53f97a

Browse files
Merge branch 'main' into readme_beautify
2 parents b7d4b35 + 0a6ba44 commit a53f97a

File tree

10 files changed

+93
-15
lines changed

10 files changed

+93
-15
lines changed

.github/ISSUE_TEMPLATE/compilation_bug_report.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ A clear and concise description of what the bug is.
1515
Issues without the full verbose output will be discarded as invalid.
1616

1717
**Mandatory: attach the sketch**
18+
or a Minimal reproducible example
1819
Issues without the sketch will be discarded as invalid.
1920

2021
**Additional context**

.github/ISSUE_TEMPLATE/miscellaneous_bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: Miscellaneous bug report
3-
about: Sketch compile but doesn't upload, or similar issues
3+
about: Sketch compiles but doesn't upload, or similar issues
44
title: ''
55
labels: ''
66
assignees: ''

.github/ISSUE_TEMPLATE/runtime_bug_report.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: Runtime bug report
3-
about: Sketch compile and uploads but doesn't run correctly (or doesn't run at all)
3+
about: Sketch compiles and uploads but doesn't run correctly (or doesn't run at all)
44
title: ''
55
labels: ''
66
assignees: ''
@@ -14,17 +14,19 @@ A clear and concise description of what the bug is.
1414
**Full verbose** compilation output, ideally with `arduino-cli` invocation or from IDE 2.3.3+
1515
Issues without the full verbose output will be discarded as invalid.
1616

17-
**Output of debug UART**
18-
Complete output of the console crash, starting from
17+
**Output of Serial Monitor**
18+
1. If you have an USB-to-Serial adapter, paste the complete output of the console crash, starting from
1919
```*** Booting Zephyr OS build v3.7...```
20-
Runtime issues without the **full UART output** will be discarded as invalid.
20+
2. If you don't, compile the sketch in `Debug` mode (see *Troubleshooting section* in README) and paste the output after invoking `sketch` command
21+
Runtime issues without the **full output** will be discarded as invalid.
2122

2223
**Output of readelf**
24+
You can find the loaction of the elf file by compiling in Verbose mode and looking near the end of the compilation output (after `Linking everything together..`)
2325
Paste (or attach) the output of `arm-none-eabi-readelf -a $your_sketch_elf_file`
2426

2527
**Optional: attach the elf file**
2628

27-
**Output: attach the sketch**
29+
**Optional: attach the sketch**
2830

2931
**Additional context**
3032
Add any other context about the problem here.

.github/workflows/package_core.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Package core
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
env:
9+
ZEPHYR_SDK_INSTALL_DIR: /opt/zephyr-sdk-0.16.8
10+
steps:
11+
- name: Install toolchain
12+
working-directory: /opt
13+
run: |
14+
sudo apt-get update
15+
sudo apt-get install -y --no-install-recommends git cmake wget python3-pip ninja-build
16+
wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.8/zephyr-sdk-0.16.8_linux-x86_64_minimal.tar.xz
17+
tar xf zephyr-sdk-0.16.8_linux-x86_64_minimal.tar.xz && cd zephyr-sdk-0.16.8 && ./setup.sh -t arm-zephyr-eabi -c
18+
19+
- uses: actions/checkout@v4
20+
21+
- name: Initialize
22+
run: |
23+
./extra/bootstrap.sh
24+
./extra/build_all.sh
25+
./extra/package.sh `git describe --always`
26+
mv ../arduino-core-zephyr-llext* .
27+
28+
- name: Archive core
29+
uses: actions/upload-artifact@v3
30+
with:
31+
name: Core
32+
path: arduino-core-zephyr-llext*

extra/package.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ if [ ! -f platform.txt ]; then
55
exit 2
66
fi
77

8+
FOLDER=`basename $PWD`
9+
810
VERSION=$1
911

10-
tar --exclude=extras/** --exclude=.git* --exclude=build --exclude=venv --exclude=samples -cjhf ../arduino-core-zephyr-llext-${VERSION}.tar.bz2 .
12+
cd ..
13+
tar --exclude=extras/** --exclude=.git* --exclude=build --exclude=venv --exclude=samples -cjhf arduino-core-zephyr-llext-${VERSION}.tar.bz2 $FOLDER

loader/boards/arduino_nano_33_ble_sense.conf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ CONFIG_ADC=y
3333
CONFIG_PWM=y
3434

3535
CONFIG_LLEXT_STORAGE_WRITABLE=n
36-
CONFIG_SHELL_STACK_SIZE=1024
37-
CONFIG_HEAP_MEM_POOL_SIZE=32000
36+
CONFIG_SHELL_STACK_SIZE=2048
37+
CONFIG_HEAP_MEM_POOL_SIZE=16384
3838
CONFIG_LLEXT_HEAP_SIZE=96
39-
CONFIG_MAIN_STACK_SIZE=64768
39+
CONFIG_MAIN_STACK_SIZE=16384
4040

4141
CONFIG_BT_RX_STACK_SIZE=4096
4242
CONFIG_BT_HCI_TX_STACK_SIZE=4096

loader/fixups.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include <cmsis_core.h>
22
#include <zephyr/init.h>
3-
void disable_mpu_rasr_xn(void)
3+
int disable_mpu_rasr_xn(void)
44
{
55
uint32_t index;
66
/* Kept the max index as 8(irrespective of soc) because the sram
@@ -18,6 +18,7 @@ void disable_mpu_rasr_xn(void)
1818
}
1919
#endif /* CONFIG_ARMV8_M_BASELINE || CONFIG_ARMV8_M_MAINLINE */
2020
}
21+
return 0;
2122
}
2223

2324
#if defined(CONFIG_BOARD_ARDUINO_NANO_33_BLE)

loader/llext_exports.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ FORCE_EXPORT_SYM(cdc_acm_dte_rate_callback_set);
9191
#endif
9292

9393
FORCE_EXPORT_SYM(k_timer_init);
94+
FORCE_EXPORT_SYM(k_fatal_halt);
9495
//FORCE_EXPORT_SYM(k_timer_user_data_set);
9596
//FORCE_EXPORT_SYM(k_timer_start);
9697

loader/main.c

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7+
#include "zephyr/sys/printk.h"
78
#include <zephyr/logging/log.h>
89
LOG_MODULE_REGISTER(app);
910

@@ -12,8 +13,18 @@ LOG_MODULE_REGISTER(app);
1213
#include <zephyr/llext/llext.h>
1314
#include <zephyr/llext/buf_loader.h>
1415
#include <zephyr/shell/shell.h>
16+
#include <zephyr/shell/shell_uart.h>
1517

1618
#include <stdlib.h>
19+
#include <zephyr/drivers/uart/cdc_acm.h>
20+
#include <zephyr/drivers/uart.h>
21+
#include <zephyr/usb/usb_device.h>
22+
23+
#if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), cdc_acm)
24+
const struct device *const usb_dev = DEVICE_DT_GET(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), cdc_acm, 0));
25+
#endif
26+
27+
static int enable_shell_usb(void);
1728

1829
#ifdef CONFIG_USERSPACE
1930
K_THREAD_STACK_DEFINE(llext_stack, CONFIG_MAIN_STACK_SIZE);
@@ -58,11 +69,23 @@ static int loader(const struct shell *sh)
5869
return -EINVAL;
5970
}
6071

72+
#if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), cdc_acm) && CONFIG_SHELL
6173
uint8_t debug = endptr[1];
6274
if (debug != 0 && strcmp(k_thread_name_get(k_current_get()), "main") == 0) {
63-
// starts the shell
75+
// disables default shell on UART
76+
shell_uninit(shell_backend_uart_get_ptr(), NULL);
77+
// enables USB and starts the shell
78+
usb_enable(NULL);
79+
int dtr;
80+
do {
81+
// wait for the serial port to open
82+
uart_line_ctrl_get(usb_dev, UART_LINE_CTRL_DTR, &dtr);
83+
k_sleep(K_MSEC(100));
84+
} while (!dtr);
85+
enable_shell_usb();
6486
return 0;
6587
}
88+
#endif
6689

6790
int header_len = 16;
6891

@@ -150,11 +173,26 @@ static int loader(const struct shell *sh)
150173

151174
#if CONFIG_SHELL
152175
SHELL_CMD_REGISTER(sketch, NULL, "Run sketch", loader);
176+
177+
#if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), cdc_acm)
178+
static int enable_shell_usb(void)
179+
{
180+
bool log_backend = CONFIG_SHELL_BACKEND_SERIAL_LOG_LEVEL > 0;
181+
uint32_t level =
182+
(CONFIG_SHELL_BACKEND_SERIAL_LOG_LEVEL > LOG_LEVEL_DBG) ?
183+
CONFIG_LOG_MAX_LEVEL : CONFIG_SHELL_BACKEND_SERIAL_LOG_LEVEL;
184+
static const struct shell_backend_config_flags cfg_flags =
185+
SHELL_DEFAULT_BACKEND_CONFIG_FLAGS;
186+
187+
shell_init(shell_backend_uart_get_ptr(), usb_dev, cfg_flags, log_backend, level);
188+
189+
return 0;
190+
}
191+
#endif
153192
#endif
154193

155194
int main(void)
156195
{
157196
loader(NULL);
158197
return 0;
159-
}
160-
198+
}

west.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ manifest:
4444
- name: ArduinoCore-API
4545
path: modules/lib/ArduinoCore-API
4646
revision: master
47-
url: git@github.com:arduino/ArduinoCore-API
47+
url: https://github.com/arduino/ArduinoCore-API

0 commit comments

Comments
 (0)