Skip to content

MISC: update to zephyr master and add initial wifi support #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Jan 13, 2025
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
136 changes: 135 additions & 1 deletion boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -337,4 +337,138 @@ portentah7.debug.server.openocd.scripts.0=interface/{programmer.protocol}.cfg
portentah7.debug.server.openocd.scripts.1={programmer.transport_script}
portentah7.debug.server.openocd.scripts.2=target/stm32h7x_dual_bank.cfg
portentah7.debug.cortex-debug.custom.request=attach
portentah7.debug.svd_file={runtime.platform.path}/svd/STM32H747_CM7.svd
portentah7.debug.svd_file={runtime.platform.path}/svd/STM32H747_CM7.svd

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

frdm_rw612.name=RW612
frdm_rw612.build.core=arduino
frdm_rw612.build.crossprefix=arm-zephyr-eabi-
frdm_rw612.build.compiler_path={runtime.tools.arm-zephyr-eabi-0.16.8.path}/bin/

frdm_rw612.menu.debug.false=Standard
frdm_rw612.menu.debug.true=Debug

frdm_rw612.menu.debug.false.post_build_arg=
frdm_rw612.menu.debug.true.post_build_arg=debug

frdm_rw612.build.variant=frdm_rw612
frdm_rw612.build.mcu=cortex-m33+nodsp
frdm_rw612.build.fpu=-mfpu=fpv5-sp-d16
frdm_rw612.build.architecture=cortex-m33+nodsp
frdm_rw612.compiler.zephyr.arch.define=

frdm_rw612.build.board={build.variant}

frdm_rw612.build.float-abi=-mfloat-abi=hard
frdm_rw612.build.extra_flags=
frdm_rw612.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit
frdm_rw612.build.board=frdm_rw612
frdm_rw612.build.extra_ldflags=
frdm_rw612.compiler.zephyr.arch.define=
frdm_rw612.compiler.zephyr.defines=-DLL_EXTENSION_BUILD -DCONFIG_ARDUINO_API_SERIAL_BUFFER_SIZE=256 -DCPU_RW612ETA2I -DRW610 -DKERNEL -DK_HEAP_MEM_POOL_SIZE=122880 -DLPFLEXCOMM_INIT_NOT_USED_IN_DRIVER=1 -DNDEBUG -DPICOLIBC_DOUBLE_PRINTF_SCANF -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -imacros{build.variant.path}/llext-edk/include/zephyr/include/generated/zephyr/autoconf.h -imacros{build.variant.path}/llext-edk/include/zephyr/include/zephyr/toolchain/zephyr_stdint.h
frdm_rw612.compiler.zephyr.ldflags=-fno-exceptions -fno-rtti -fno-threadsafe-statics -fno-unwind-tables -fno-use-cxa-atexit
frdm_rw612.compiler.zephyr.cflags=-fno-strict-aliasing -fno-printf-return-value -fno-common -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop --specs=picolibc.specs -D_POSIX_THREADS -mlong-calls -nodefaultlibs
frdm_rw612.compiler.zephyr.cxxflags={compiler.zephyr.ldflags} -fdata-sections -ffunction-sections -fno-unwind-tables -fno-strict-aliasing -fno-printf-return-value -fno-common -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -fno-asynchronous-unwind-tables -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop --specs=picolibc.specs -D_POSIX_THREADS -mlong-calls -nodefaultlibs
frdm_rw612.compiler.zephyr.includes={build.variant.path}/includes.txt
frdm_rw612.compiler.zephyr.extra_ldflags=-lstdc++ -lsupc++ -lnosys -nostdlib
frdm_rw612.compiler.zephyr=
frdm_rw612.vid.0=0x1fc9
frdm_rw612.pid.0=0x0143
frdm_rw612.upload_port.0.vid=0x1fc9
frdm_rw612.upload_port.0.pid=0x0143
frdm_rw612.upload.address=0x18323000
frdm_rw612.upload.target=rw612

frdm_rw612.upload.tool=pyocd
frdm_rw612.upload.tool.default=pyocd
frdm_rw612.upload.protocol=
frdm_rw612.upload.transport=
frdm_rw612.upload.vid=0x1fc9
frdm_rw612.upload.pid=0x0143
frdm_rw612.upload.interface=0
frdm_rw612.upload.use_1200bps_touch=false
frdm_rw612.upload.wait_for_upload_port=false
frdm_rw612.upload.native_usb=true
frdm_rw612.upload.maximum_size=1966080
frdm_rw612.upload.maximum_data_size=523624

frdm_rw612.bootloader.tool=pyocd
frdm_rw612.bootloader.tool.default=pyocd
frdm_rw612.bootloader.file=zephyr-frdm_rw612.elf
frdm_rw612.bootloader.target=rw612

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

niclasense.name=Arduino Nicla Sense ME
niclasense.build.core=arduino
niclasense.build.crossprefix=arm-zephyr-eabi-
niclasense.build.compiler_path={runtime.tools.arm-zephyr-eabi-0.16.8.path}/bin/

niclasense.menu.debug.false=Standard
niclasense.menu.debug.true=Debug

niclasense.menu.debug.false.post_build_arg=
niclasense.menu.debug.true.post_build_arg=debug

niclasense.build.variant=arduino_nicla_sense_me
niclasense.build.mcu=cortex-m4
niclasense.build.fpu=-mfpu=fpv4-sp-d16
niclasense.build.architecture=cortex-m4
niclasense.compiler.zephyr.arch.define=

niclasense.build.board={build.variant}

niclasense.build.float-abi=-mfloat-abi=hard
niclasense.build.extra_flags=
niclasense.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit
niclasense.build.architecture=cortex-m4
niclasense.build.board=ARDUINO_NICLA_SENSE_ME
niclasense.build.extra_ldflags=
niclasense.compiler.zephyr.defines=-DLL_EXTENSION_BUILD -DCONFIG_ARDUINO_API_SERIAL_BUFFER_SIZE=256 -DNRF52832_XXAA -DK_HEAP_MEM_POOL_SIZE=1024 -DKERNEL -DPICOLIBC_LONG_LONG_PRINTF_SCANF -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -imacros{build.variant.path}/llext-edk/include/zephyr/include/generated/zephyr/autoconf.h -imacros{build.variant.path}/llext-edk/include/zephyr/include/zephyr/toolchain/zephyr_stdint.h
niclasense.compiler.zephyr.ldflags=-fno-exceptions -fno-rtti -fno-threadsafe-statics -fno-unwind-tables -fno-use-cxa-atexit
niclasense.compiler.zephyr.cflags=-fno-strict-aliasing -fno-printf-return-value -fno-common -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop --specs=picolibc.specs -D_POSIX_THREADS -mlong-calls -nodefaultlibs
niclasense.compiler.zephyr.cxxflags={compiler.zephyr.ldflags} -fdata-sections -ffunction-sections -fno-unwind-tables -fno-strict-aliasing -fno-printf-return-value -fno-common -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee -mtp=soft -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wdouble-promotion -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -fno-asynchronous-unwind-tables -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop --specs=picolibc.specs -D_POSIX_THREADS -mlong-calls -nodefaultlibs
niclasense.compiler.zephyr.includes={build.variant.path}/includes.txt
niclasense.compiler.zephyr.extra_ldflags=-lstdc++ -lsupc++ -lnosys -nostdlib
niclasense.compiler.zephyr=
niclasense.vid.0=0x2341
niclasense.pid.0=0x0360
niclasense.upload_port.0.vid=0x2341
niclasense.upload_port.0.pid=0x0060

#niclasense.upload.tool=openocd
#niclasense.upload.tool.default=openocd
niclasense.upload.tool=pyocd
niclasense.upload.tool.default=pyocd
niclasense.upload.protocol=
niclasense.upload.transport=
niclasense.upload.vid=0x2341
niclasense.upload.pid=0x0060
niclasense.upload.interface=0
niclasense.upload.use_1200bps_touch=false
niclasense.upload.wait_for_upload_port=false
niclasense.upload.native_usb=false
niclasense.upload.maximum_size=1966080
niclasense.upload.maximum_data_size=523624
niclasense.upload.address=0x70000
niclasense.upload.target=nrf52

niclasense.upload.maximum_size=786432
niclasense.upload.maximum_data_size=523624

#niclasense.bootloader.tool=openocd
#niclasense.bootloader.tool.default=openocd
niclasense.bootloader.tool=pyocd
niclasense.bootloader.tool.default=pyocd
niclasense.bootloader.vid=0x2341
niclasense.bootloader.pid=0x0360
niclasense.bootloader.interface=0
niclasense.bootloader.file=zephyr-arduino_nicla_sense_me.hex
niclasense.bootloader.target=nrf52

niclasense.debug.tool=gdb
niclasense.debug.server.openocd.scripts.0=interface/{programmer.protocol}.cfg
niclasense.debug.server.openocd.scripts.1={programmer.transport_script}
niclasense.debug.server.openocd.scripts.2=target/nrf52.cfg
niclasense.debug.cortex-debug.custom.request=attach
26 changes: 26 additions & 0 deletions cores/arduino/abi.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright (c) 2024 Arduino SA
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <stdlib.h>

extern "C" void __cxa_pure_virtual(void) {}
extern "C" void __cxa_deleted_virtual(void) {}
extern "C" int __cxa_atexit(void (*func) (void *), void * arg, void * dso_handle) {
return 0;
}

namespace std {
void __throw_length_error(const char* __s __attribute__((unused))) {}
};

extern "C" int strcmp(const char* s1, const char* s2) {
while(*s1 && (*s1 == *s2))
{
s1++;
s2++;
}
return *(const unsigned char*)s1 - *(const unsigned char*)s2;
}
32 changes: 22 additions & 10 deletions cores/arduino/new
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#define NEW_H

#include <stdlib.h>
//#pragma long_calls

namespace std {
struct nothrow_t {};
Expand All @@ -27,25 +28,36 @@ namespace std {
using size_t = ::size_t;
} // namespace std

[[gnu::weak]] void * operator new(std::size_t size);
[[gnu::weak]] void * operator new[](std::size_t size);
void * operator new(std::size_t size);
void * operator new[](std::size_t size);

[[gnu::weak]] void * operator new(std::size_t size, const std::nothrow_t tag) noexcept;
[[gnu::weak]] void * operator new[](std::size_t size, const std::nothrow_t& tag) noexcept;
#if __cplusplus >= 201703L
void * operator new(std::size_t count, std::align_val_t al);
void * operator new[](std::size_t count, std::align_val_t al);

void* operator new(std::size_t count, std::align_val_t al,
const std::nothrow_t& tag) noexcept;
void* operator new[](std::size_t count, std::align_val_t al,
const std::nothrow_t& tag) noexcept;
#endif

void * operator new(std::size_t size, const std::nothrow_t tag) noexcept;
void * operator new[](std::size_t size, const std::nothrow_t& tag) noexcept;

void * operator new(std::size_t size, void *place) noexcept;
void * operator new[](std::size_t size, void *place) noexcept;

[[gnu::weak]] void operator delete(void * ptr) noexcept;
[[gnu::weak]] void operator delete[](void * ptr) noexcept;

void operator delete(void * ptr) noexcept;
void operator delete[](void * ptr) noexcept;

#if __cplusplus >= 201402L
[[gnu::weak]] void operator delete(void* ptr, std::size_t size) noexcept;
[[gnu::weak]] void operator delete[](void * ptr, std::size_t size) noexcept;
void operator delete(void* ptr, std::size_t size) noexcept;
void operator delete[](void * ptr, std::size_t size) noexcept;
#endif // __cplusplus >= 201402L

[[gnu::weak]] void operator delete(void* ptr, const std::nothrow_t& tag) noexcept;
[[gnu::weak]] void operator delete[](void* ptr, const std::nothrow_t& tag) noexcept;
void operator delete(void* ptr, const std::nothrow_t& tag) noexcept;
void operator delete[](void* ptr, const std::nothrow_t& tag) noexcept;

void operator delete(void* ptr, void* place) noexcept;
void operator delete[](void* ptr, void* place) noexcept;
Expand Down
34 changes: 31 additions & 3 deletions cores/arduino/new.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

#include "new.h"

extern "C" void __cxa_pure_virtual() {}

// The C++ spec dictates that allocation failure should cause the
// (non-nothrow version of the) operator new to throw an exception.
// Since we expect to have exceptions disabled, it would be more
Expand Down Expand Up @@ -46,6 +44,36 @@ void * operator new[](std::size_t size) {
return operator new(size);
}

#if __cplusplus >= 201703L
void* operator new(std::size_t count, std::align_val_t al) {
return operator new(count);
}

void* operator new[](std::size_t count, std::align_val_t al) {
return operator new(count);
}

void * operator new(std::size_t size, std::align_val_t al, const std::nothrow_t tag) noexcept {
#if defined(NEW_TERMINATES_ON_FAILURE)
// Cannot call throwing operator new as standard suggests, so call
// new_helper directly then
return new_helper(size);
#else
return operator new(size);
#endif
}

void * operator new[](std::size_t size, std::align_val_t al, const std::nothrow_t& tag) noexcept {
#if defined(NEW_TERMINATES_ON_FAILURE)
// Cannot call throwing operator new[] as standard suggests, so call
// malloc directly then
return new_helper(size);
#else
return operator new[](size);
#endif
}
#endif

void * operator new(std::size_t size, const std::nothrow_t tag) noexcept {
#if defined(NEW_TERMINATES_ON_FAILURE)
// Cannot call throwing operator new as standard suggests, so call
Expand Down Expand Up @@ -104,4 +132,4 @@ void operator delete(void* ptr, void* place) noexcept {
void operator delete[](void* ptr, void* place) noexcept {
(void)ptr; (void)place; // unused
// Nothing to do
}
}
5 changes: 3 additions & 2 deletions extra/build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
set -e

./extra/build.sh arduino_giga_r1//m7 arduino_giga_r1_m7
./extra/build.sh arduino_nano_33_ble_sense arduino_nano_33_ble_sense
./extra/build.sh arduino_nano_33_ble//sense arduino_nano_33_ble_sense
./extra/build.sh arduino_portenta_h7//m7 arduino_portenta_h7
./extra/build.sh ek_ra8d1 ek_ra8d1
./extra/build.sh frdm_mcxn947/mcxn947/cpu0 frdm_mcxn947_mcxn947_cpu0
./extra/build.sh frdm_mcxn947/mcxn947/cpu0 frdm_mcxn947_mcxn947_cpu0
./extra/build.sh frdm_rw612 frdm_rw612
Binary file modified firmwares/zephyr-arduino_giga_r1_m7.bin
Binary file not shown.
Binary file modified firmwares/zephyr-arduino_giga_r1_m7.elf
Binary file not shown.
Binary file modified firmwares/zephyr-arduino_nano_33_ble_sense.bin
Binary file not shown.
Binary file modified firmwares/zephyr-arduino_nano_33_ble_sense.elf
Binary file not shown.
Binary file added firmwares/zephyr-arduino_nicla_sense_me.bin
Binary file not shown.
Binary file added firmwares/zephyr-arduino_nicla_sense_me.elf
Binary file not shown.
Binary file modified firmwares/zephyr-arduino_portenta_h7.bin
Binary file not shown.
Binary file modified firmwares/zephyr-arduino_portenta_h7.elf
Binary file not shown.
Binary file modified firmwares/zephyr-ek_ra8d1.elf
Binary file not shown.
Loading
Loading