Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/package_core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@ jobs:

- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 0
persist-credentials: false
fetch-tags: true

- name: Initialize Zephyr environment
run: |
Expand Down
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "libraries/Arduino_RPCLite"]
path = libraries/Arduino_RPCLite
url = [email protected]:arduino-libraries/Arduino_RPCLite.git
[submodule "libraries/Arduino_RouterBridge"]
path = libraries/Arduino_RouterBridge
url = [email protected]:arduino-libraries/Arduino_RouterBridge.git
53 changes: 53 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -521,3 +521,56 @@ opta.debug.cortex-debug.custom.request=attach
opta.debug.svd_file={runtime.platform.path}/svd/STM32H747_CM7.svd

##############################################################################################################

unoq.name=Arduino UNO Q
unoq.build.core=arduino
unoq.build.crossprefix=arm-zephyr-eabi-
unoq.build.compiler_path={runtime.tools.arm-zephyr-eabi-0.16.8.path}/bin/

unoq.menu.link_mode.dynamic=Dynamic
unoq.menu.link_mode.static=Static
unoq.menu.link_mode.static.build.link_mode=static
unoq.menu.link_mode.static.upload.extension=bin-zsk.bin

unoq.build.zephyr_target=arduino_uno_q
unoq.build.zephyr_args=
unoq.build.variant=arduino_uno_q_stm32u585xx
unoq.build.mcu=cortex-m33
unoq.build.fpu=-mfpu=fpv5-sp-d16
unoq.build.architecture=cortex-m33
unoq.compiler.zephyr.arch.define=

unoq.build.float-abi=-mfloat-abi=hard
unoq.build.extra_flags=
unoq.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit
unoq.build.board=UNO_Q
unoq.build.zephyr_hals=hal_stm32
unoq.compiler.zephyr.arch.define=
unoq.compiler.zephyr=
unoq.vid.0=0x2341
unoq.pid.0=0x0078
unoq.upload_port.0.vid=0x2341
unoq.upload_port.0.pid=0x0078
unoq.upload.address=0x80F0000
unoq.upload.target=stm32u585zitxq

unoq.upload.tool=remoteocd
unoq.upload.tool.default=remoteocd
unoq.upload.tool.network=remoteocd_network
unoq.upload.protocol=
unoq.upload.transport=
unoq.upload.vid=0x2341
unoq.upload.pid=0x0078
unoq.upload.interface=0
unoq.upload.use_1200bps_touch=false
unoq.upload.wait_for_upload_port=false
unoq.upload.native_usb=true
unoq.upload.maximum_size=1966080
unoq.upload.maximum_data_size=523624

unoq.bootloader.tool=remoteocd
unoq.bootloader.tool.default=remoteocd
unoq.bootloader.file=zephyr-{build.variant}.elf
unoq.bootloader.target=stm32u585zitxq

##########################################################################################
5 changes: 5 additions & 0 deletions cores/arduino/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
#undef DIGITAL_PIN_CHECK_UNIQUE
#endif

// Helper macro to get Arduino pin number from device tree alias
#define DIGITAL_PIN_GPIOS_FIND_NODE(node) \
DIGITAL_PIN_GPIOS_FIND_PIN(DT_REG_ADDR(DT_PHANDLE_BY_IDX(node, gpios, 0)), \
DT_PHA_BY_IDX(node, gpios, 0, pin))

#ifndef LED_BUILTIN

/* Return the index of it if matched, oterwise return 0 */
Expand Down
7 changes: 6 additions & 1 deletion cores/arduino/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ void start_static_threads();
void __attribute__((weak)) initVariant(void) {
}

// This function can be overwriten by one library.
void __attribute__((weak)) __loopHook(void) {
}

int main(void) {
#if (DT_NODE_HAS_PROP(DT_PATH(zephyr_user), cdc_acm) && \
(CONFIG_USB_CDC_ACM || CONFIG_USBD_CDC_ACM_CLASS))
Expand All @@ -39,6 +43,7 @@ int main(void) {
// DT_NODE_HAS_PROP(DT_PATH(zephyr_user), serials)
if (arduino::serialEventRun) arduino::serialEventRun();
#endif
__loopHook();
}

return 0;
Expand Down Expand Up @@ -94,7 +99,7 @@ extern "C" __attribute__((section(".entry_point"), used)) void entry_point(struc
printk("Sketch Heap start: %p, size %p\n", &kheap_llext_heap, &kheap_llext_heap_size);

memcpy(&_sdata, &_sidata, (&_edata - &_sdata) * sizeof(uint32_t));
memset(&_sbss, 0, &_ebss - &_sbss);
memset(&_sbss, 0, (&_ebss - &_sbss) * sizeof(uint32_t));
__libc_init_array();
main();
}
2 changes: 1 addition & 1 deletion cores/arduino/zephyrCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ void analogWrite(enum dacPins dacName, int value) {

#ifdef CONFIG_ADC

void analogReference(uint8_t mode) {
void __attribute__((weak)) analogReference(uint8_t mode) {
/*
* The Arduino API not clearly defined what means of
* the mode argument of analogReference().
Expand Down
25 changes: 25 additions & 0 deletions extra/install_remoteocd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh

REPO_URL="https://github.com/bcmi-labs/orchestrator.git"
BRANCH_NAME="main"

set -xe

TMP_DIR=$(mktemp -d)

# pull the repo
git clone "$REPO_URL" "$TMP_DIR"
cd "$TMP_DIR"
git checkout "$BRANCH_NAME"

# compile remoteocd
go build -o build/remoteocd ./cmd/remoteocd

# move into arduino tools
TARGET_PATH=$(arduino-cli config get directories.data)/packages/arduino/tools/remoteocd/0.0.1
mkdir -p "$TARGET_PATH"
cp build/remoteocd "$TARGET_PATH"

rm -rf "$TMP_DIR"

echo "remoteocd is in $TARGET_PATH/remoteocd"
13 changes: 13 additions & 0 deletions extra/zephyr-core-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
},
{
"name": "NXP FRDM RW612"
},
{
"name": "Arduino UNO Q"
}
],
"toolsDependencies": [
Expand Down Expand Up @@ -65,6 +68,16 @@
"packager": "arduino",
"name": "sync-zephyr-artifacts",
"version": "0.1.0"
},
{
"packager": "arduino",
"name": "adb",
"version": "32.0.0"
},
{
"packager": "arduino",
"name": "remoteocd",
"version": "0.0.3-rc.2"
}
]
}
Expand Down
115 changes: 115 additions & 0 deletions libraries/Arduino_LED_Matrix/examples/Basic/Basic.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
#include "ArduinoGraphics.h"
#include "Arduino_LED_Matrix.h"

Arduino_LED_Matrix matrix;

void setup() {
// put your setup code here, to run once:
matrix.begin();
matrix.textFont(Font_5x7);
matrix.textScrollSpeed(100);
matrix.clear();
Serial.begin(115200);
}

uint8_t shades[104] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
};

const uint32_t animation[][5] = {
{ 0x38022020,
0x810408a0,
0x2200e800,
0x20000000,
66 },
{ 0x1c011010,
0x40820450,
0x11007400,
0x10000000,
66 },
{ 0x0e008808,
0x20410228,
0x08803a00,
0x08000000,
66 },
{ 0x07004404,
0x10208114,
0x04401d00,
0x04000000,
66 },
{ 0x03802202,
0x0810408a,
0x02200e80,
0x02000000,
66 },
{ 0x01c01101,
0x04082045,
0x01100740,
0x01000000,
66 },
{ 0x00e00880,
0x82041022,
0x808803a0,
0x00000000,
66 },
{ 0x00700440,
0x40020011,
0x004401c0,
0x00000000,
66 },
{ 0x00380200,
0x20010008,
0x802000e0,
0x00000000,
66 },
{ 0x00180100,
0x10008004,
0x00100060,
0x00000000,
66 },
{ 0x00080080,
0x08004002,
0x00080020,
0x00000000,
66 },
{ 0x00000040,
0x04002001,
0x00040000,
0x00000000,
66 },
{ 0x00000000,
0x02001000,
0x80000000,
0x00000000,
66 },
{ 0x00000000,
0x00000000,
0x00000000,
0x00000000,
66 }
};

void loop() {
// Roll a string using ArduinoGraphics
matrix.beginText(0, 0, 127, 0, 0); // X, Y, then R, G, B
matrix.print(" arduino.cc/uno-q ");
matrix.endText(SCROLL_LEFT);
delay(1000);
// Draw shades
matrix.setGrayscaleBits(3);
matrix.draw(shades);
delay(1000);
matrix.clear();
// Play an animation
matrix.loadSequence(animation);
for (int i = 0; i < 10; i++) {
matrix.playSequence();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#include "bootanimation.h"
#include "ArduinoGraphics.h"
#include "Arduino_LED_Matrix.h"
#include <zephyr/storage/flash_map.h>

Arduino_LED_Matrix matrix;

bool ok = false;

void setup() {

Serial.begin(115200);
matrix.begin();
matrix.textFont(Font_5x7);
matrix.setGrayscaleBits(8);

// Before flashing, show the animation
for (int i = 0; i < 2; i++) {
matrix.playVideo(bootanimation.buf_loop, bootanimation.len_loop);
}
matrix.playVideo((uint8_t*)(bootanimation.buf_loop + bootanimation.len_loop), bootanimation.len_end);

const struct flash_area *fa;
int rc;
rc = flash_area_open(FIXED_PARTITION_ID(bootanimation), &fa);
if (rc) {
return;
}

// flash the bootanimation header
rc = flash_area_erase(fa, 0, fa->fa_size);
if (rc) {
return;
}
int header_len = sizeof(bootanimation) - sizeof(char*);
rc = flash_area_write(fa, 0, &bootanimation, header_len);
if (rc) {
return;
}
rc = flash_area_write(fa, header_len, bootanimation.buf_loop, bootanimation.len_loop + bootanimation.len_end);
if (rc) {
return;
}
uint32_t flash_area[256];
flash_area_read(fa, 0, flash_area, 256);
Serial.println(flash_area[0], HEX);
Serial.println(flash_area[1], HEX);
Serial.println(flash_area[2], HEX);
Serial.println(flash_area[3], HEX);
Serial.println(flash_area[4], HEX);
Serial.println(flash_area[5], HEX);
ok = true;
}

void loop() {
matrix.beginText(0, 0, 127, 0, 0); // X, Y, then R, G, B
if (ok) {
matrix.print("OK :)");
} else {
matrix.print("KO :(");
}
matrix.endText();
}
Loading
Loading