-
Notifications
You must be signed in to change notification settings - Fork 59
libraries: loader: Bump to 0.53.1 (excluding blobs) #160
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
Open
soburi
wants to merge
100
commits into
zephyrproject-rtos:next
Choose a base branch
from
soburi:import_loader
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+6,274
−0
Open
Changes from all commits
Commits
Show all changes
100 commits
Select commit
Hold shift + click to select a range
9e1fbac
Add multitarget loader project
facchinm 82d7eba
nano33ble: add support
facchinm f8a2687
post_build: offset fixed to 16 bytes
facchinm 4cd2648
nano33ble: compatibility with ArduinoBLE via HCI_RAW
facchinm c871e14
test: use memory mapped address if CONFIG_LLEXT_STORAGE_WRITABLE=n
facchinm 94eceb6
loader: allow CONFIG_USERSPACE builds
facchinm f08a5f7
initial: add SocketWrapper library
facchinm 11eb433
portenta_h7: replace USERSPACE with disable_mpu_rasr_xn hack
facchinm 4906de3
SocketWrapper: implement Server
facchinm 837fbf4
loader: redirect shell to USB if sketch is in Debug mode
facchinm 6268b88
loader: remove warning
facchinm 7ddbc7f
loader: fix build for boards without USB CDC
facchinm fa63824
giga: complete dt overlay and prepare for camera support
facchinm a71a571
llext_exports: add missing APIs from WCharacter
facchinm 34e24be
llext_exports: properly export kernel objects
facchinm aec0de2
net: handle dhcp properly
facchinm 45010f1
initial: add WiFi APIs
facchinm 938abb3
network: add UDP wrapper
facchinm 3358d77
portenta: ssl: enable mbedtls
facchinm 9a336a3
Implement SetClock Function
mjs513 e483b7b
Added SDRAM + Lib + llext_export changes
mjs513 1dd2853
Move CONFIG_CPP to default prj.conf
facchinm 2a73c6e
loader: Add support for shared multi-heap.
iabdalkader 90c0935
enable static threads
mjs513 28c39a8
temp: fix display/camera coexistence
facchinm d75e9f6
loader: fix ringbuffer exports
facchinm a069c44
loader: enable USB only for legacy stack
facchinm d235642
fixme: add bootloader reflasher for c33
facchinm 2a0aeb9
wip: linked build
facchinm d73afb2
wip: c33
facchinm ab5d46a
usb: start supporting USB_DEVICE_STACK_NEXT
facchinm cff9545
loader: move cache config to be board specific
facchinm 12e08df
loader: cleanups
pillo79 0265d27
post-build: rework to use empty area in ELF header or add it in binaries
pillo79 6adacab
loader: fix rw612 and ek_ra8
facchinm 20d1009
build.sh: get the variant name from the Zephyr build system
pillo79 0403612
llext_exports: remove dropped net_buf_get
pillo79 435bf5a
main: fix enable_shell_usb warnings
pillo79 d3d4194
loader: enable the Arduino API module
pillo79 73696e8
loader: fix loading of prelinked sketch
facchinm dff9073
nano33ble: disable stack canaries
facchinm 088f07c
SocketWrapper: start restucturing lib
facchinm 53e5a17
loader: fix offset for CONFIG_LLEXT_STORAGE_WRITABLE
facchinm 45ed0fe
loader: add exports for wifiAP
facchinm 3fbf971
loader: move dhcp server in own ifdef
facchinm 7953bd3
update to llext_exports.c
mjs513 ffa6cf6
loader: export shared_multi_heap_alloc if SHARED_MULTI_HEAP is enabled
facchinm 70acdd6
added link to pow
e1d232a
nano33: llext heap fix and add math functions to LLEXT_EXPORTS.C (#109)
mjs513 d3dce71
zephyr: update to zephyr-arduino-20250520
pillo79 96f6f27
Added freeaddrinfo after getaddrinfo call
andreagilardoni e6de2de
Upate Camera support to reflect changes in API
mjs513 fbad95e
loader/fixup: Fix SMH init priority.
iabdalkader d5a4dd5
giga: enable bluetooth
facchinm 4812dd9
loader: impl: add some libc/::std functions
facchinm 0a3654b
loader: correct _sketch_start for linked builds
facchinm fa8391f
c33: fix missing std:: functionality at link time
facchinm 3cec73e
linked: enforce maximum size of sketch in linker script
pillo79 fa09459
loader: Export BT firmware symbols.
iabdalkader 1c622c8
loader: Export bt_ctlr_set_public_addr.
iabdalkader 7d9d7c7
stm32h7: restore 1200bps functionality by enabling Backup area access
facchinm 43d81cd
GiGA Touch - define a callback function forwarder.
KurtE 314cae4
llext: wrap *ipv4* function exports inside CONFIG_NET_IPV4
pennam de0bd07
loader: Export missing ring_buf symbols.
iabdalkader ebc7be0
misc: Format repo using clang-format.
iabdalkader ffabfd1
usb: refactor USBD_NEXT and implement 1200bps touch
facchinm 022c27b
loader: Add input callback data.
iabdalkader 772ee72
UNO Q: initial import
facchinm 6e8b624
unoq: add bootanimation support
facchinm e5d191c
unoq: implement analogReference
facchinm 139f746
test: unoq: implement direct RAM loading
facchinm b0cc291
matrix: optimize turnLed function.
iabdalkader 8e2748d
ethernet lib: set mac address, log module fix
leonardocavagnis e03d921
Ethernet lib: add default examples
leonardocavagnis edb3356
ethernet: remove setter overloads
pennam 269504a
loader: Export file system symbols.
iabdalkader f349ddb
threads: change main thread priority to 14
pennam b82032a
giga_r1: load firmware image from QSPI flash
pillo79 7d869c3
fix: add all missing math.h functions
facchinm b58a9b8
posix: define M_PI and other stuff in Zephyr sketches
pillo79 03bb49e
loader: config: set CONFIG_EVENTS=y
facchinm e8721d3
loader: add symbols for Arduino_JSON library
hajimef 334c350
llext: add vsnprintf to exported symbols
pennam eb14d91
loader: return if sketch_buf could not be allocated
silabs-bozont 2543a53
loader: Export the correct sketch log symbols.
iabdalkader bab021b
loader: Support relocating sections to different memory regions.
iabdalkader c908c38
variants: Disable some features for production build.
iabdalkader 0a10c52
loader: fix missing pulseIn() implementation
pillo79 445194d
loader: redirect logs to uart
pennam c2971da
prj: move CONFIG_INPUT_THREAD_* into giga r1 variant
pennam 62e21b4
prj: disable SHELL and CPP for alla variants
pennam a4063f5
unoq: use user stack for parking sketch in RAM mode
facchinm 03129dc
Arduino_LED_Matrix: add const to matrixWrite
KurtE 987ca52
loader: fix unoq analog_reference return values
pillo79 f03f512
loader: minor warning cleanup
pillo79 564bd22
loader: log: early enable usb only if debug is active
pennam f47acbb
loader: additional fixes for Arduino_JSON
pillo79 775d2bd
loader: unoq: increase ram buffer
pennam a5bb68c
manifest: configure loader firmware as downloadable blobs
soburi 96f388e
loader: blobs: CMakeLists.txt: Update path for downloadable blobs
soburi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| #set(DTC_OVERLAY_FILE ${BOARD}.overlay) | ||
|
|
||
| cmake_minimum_required(VERSION 3.20.0) | ||
|
|
||
| # get value of NORMALIZED_BOARD_TARGET early | ||
| find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} COMPONENTS yaml boards) | ||
|
|
||
| set(DTC_OVERLAY_FILE ${CMAKE_CURRENT_LIST_DIR}/../variants/${NORMALIZED_BOARD_TARGET}/${NORMALIZED_BOARD_TARGET}.overlay) | ||
| set(EXTRA_CONF_FILE ${CMAKE_CURRENT_LIST_DIR}/../variants/${NORMALIZED_BOARD_TARGET}/${NORMALIZED_BOARD_TARGET}.conf) | ||
|
|
||
| find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
|
|
||
| project(app LANGUAGES C CXX) | ||
|
|
||
| add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/blobs) | ||
|
|
||
| # Memory region relocation based on Kconfig | ||
| # Relocate LLEXT heap if region specified | ||
| if(NOT "${CONFIG_LLEXT_HEAP_REGION}" STREQUAL "") | ||
| zephyr_code_relocate(FILES ${ZEPHYR_BASE}/subsys/llext/llext_mem.c | ||
| LOCATION ${CONFIG_LLEXT_HEAP_REGION}_BSS_NOINIT) | ||
| endif() | ||
|
|
||
| # Relocate main stack if region specified | ||
| if(NOT "${CONFIG_MAIN_STACK_REGION}" STREQUAL "") | ||
| zephyr_code_relocate(FILES ${ZEPHYR_BASE}/kernel/init.c | ||
| LOCATION ${CONFIG_MAIN_STACK_REGION}_BSS_NOINIT) | ||
| endif() | ||
|
|
||
|
|
||
| # for USB device stack NEXT | ||
| target_sources_ifdef(CONFIG_USB_DEVICE_STACK_NEXT app PRIVATE | ||
| ${CMAKE_CURRENT_LIST_DIR}/../cores/arduino/usb_device_descriptor.c | ||
| ) | ||
|
|
||
| FILE(GLOB app_sources *.c) | ||
| target_sources(app PRIVATE ${app_sources}) | ||
| target_compile_definitions(app PUBLIC _XOPEN_SOURCE=700) | ||
|
|
||
| target_link_libraries(app PUBLIC blobs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # | ||
| # Copyright (c) 2025 Arduino | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # | ||
|
|
||
| source "Kconfig.zephyr" | ||
|
|
||
| config LLEXT_HEAP_REGION | ||
| string "LLEXT heap memory region" | ||
| depends on CODE_DATA_RELOCATION | ||
| help | ||
| Specify the memory region for LLEXT heap. | ||
|
|
||
| config MAIN_STACK_REGION | ||
| string "Main stack memory region" | ||
| depends on CODE_DATA_RELOCATION | ||
| help | ||
| Specify the memory region for main stack. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| /* | ||
| * Copyright 2025 Arduino SA | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| #include <zephyr/devicetree.h> | ||
| #include "wiced_resource.h" | ||
|
|
||
| #define QUADSPI_MMAP_BASE DT_REG_ADDR_BY_IDX(DT_NODELABEL(quadspi), 1) | ||
| #define FLASH_CHIP_OFFSET DT_REG_ADDR(DT_NODELABEL(qspi_flash)) | ||
| #define AIROC_PART_OFS DT_REG_ADDR(DT_NODELABEL(airoc_firmware)) | ||
|
|
||
| #define FW_ADDR (QUADSPI_MMAP_BASE + FLASH_CHIP_OFFSET + AIROC_PART_OFS) | ||
| #define FW_SIZE 421098 /* same as the _bin.c file */ | ||
|
|
||
| const resource_hnd_t wifi_firmware_image = { | ||
| RESOURCE_IN_MEMORY, | ||
| FW_SIZE, | ||
| { .mem = { (const char *) FW_ADDR } } | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| zephyr_interface_library_named(blobs) | ||
|
|
||
| if (CONFIG_BOARD_ARDUINO_PORTENTA_C33) | ||
| set(gen_inc_dir ${ZEPHYR_BINARY_DIR}/misc/generated) | ||
| zephyr_include_directories(${gen_inc_dir}) | ||
| set(gen_dir ${gen_inc_dir}/c33_bl_patch) | ||
| generate_inc_file_for_target( | ||
| ${ZEPHYR_CURRENT_LIBRARY} | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/../../zephyr/blobs/loader/4343WA1_clm_blob.c)/c33_bl.bin | ||
| ${gen_dir}/c33_bl.bin.inc | ||
| ) | ||
| endif() | ||
|
|
||
| if(CONFIG_AIROC_WIFI_CUSTOM) | ||
| zephyr_include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../zephyr/blobs/loader/) # for wifi_nvram_image.h | ||
| zephyr_library_sources(${CMAKE_CURRENT_SOURCE_DIR}/../../zephyr/blobs/loader/4343WA1_clm_blob.c) | ||
| zephyr_library_sources(4343WA1_bin_qspi.c) # use _bin.c for a static build | ||
| endif() |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,256 @@ | ||
| #include <cmsis_core.h> | ||
| #include <zephyr/init.h> | ||
|
|
||
| #ifndef CONFIG_CPP | ||
| void __cxa_pure_virtual() { | ||
| while (1) | ||
| ; | ||
| } | ||
| #endif | ||
|
|
||
| int disable_mpu_rasr_xn(void) { | ||
| uint32_t index; | ||
| /* Kept the max index as 8(irrespective of soc) because the sram | ||
| * would most likely be set at index 2. | ||
| */ | ||
| for (index = 0U; index < 8; index++) { | ||
| MPU->RNR = index; | ||
| #if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE) | ||
| if (MPU->RBAR & MPU_RBAR_XN_Msk) { | ||
| MPU->RBAR ^= MPU_RBAR_XN_Msk; | ||
| } | ||
| #else | ||
| if (MPU->RASR & MPU_RASR_XN_Msk) { | ||
| MPU->RASR ^= MPU_RASR_XN_Msk; | ||
| } | ||
| #endif /* CONFIG_ARMV8_M_BASELINE || CONFIG_ARMV8_M_MAINLINE */ | ||
| } | ||
| return 0; | ||
| } | ||
|
|
||
| #if defined(CONFIG_BOARD_ARDUINO_NANO_33_BLE) | ||
| int disable_bootloader_mpu() { | ||
| // MPU was previously enabled in the bootloader | ||
| // https://github.com/bcmi-labs/zephyr/blob/31cb7dd00fd5bce4c69896b3b2ddf6259d0c0f2b/boards/arm/arduino_nano_33_ble/arduino_nano_33_ble_defconfig#L10C1-L10C15 | ||
| __disable_irq(); | ||
| disable_mpu_rasr_xn(); | ||
| __DMB(); | ||
| MPU->CTRL = 0; | ||
| __enable_irq(); | ||
| return 0; | ||
| } | ||
|
|
||
| SYS_INIT(disable_bootloader_mpu, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); | ||
| #endif | ||
|
|
||
| #if defined(CONFIG_ARM_MPU) | ||
| SYS_INIT(disable_mpu_rasr_xn, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); | ||
| #endif | ||
|
|
||
| #if defined(CONFIG_SOC_STM32H747XX_M7) | ||
| int enable_bkp_access(void) { | ||
| /* Enable access to the backup domain */ | ||
| // HAL_PWR_EnableBkUpAccess(); | ||
| SET_BIT(PWR->CR1, PWR_CR1_DBP); | ||
| return 0; | ||
| } | ||
|
|
||
| SYS_INIT(enable_bkp_access, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); | ||
| #endif | ||
|
|
||
| #if defined(CONFIG_INPUT) | ||
| #include <zephyr/kernel.h> | ||
| #include <zephyr/device.h> | ||
| #include <zephyr/input/input.h> | ||
| typedef void (*zephyr_input_callback_t)(struct input_event *evt, void *user_data); | ||
|
|
||
| static zephyr_input_callback_t zephyr_input_cb_func = NULL; | ||
| static void *zephyr_input_cb_data = NULL; | ||
|
|
||
| void zephyr_input_register_callback(zephyr_input_callback_t cb, void *user_data) { | ||
| zephyr_input_cb_func = cb; | ||
| zephyr_input_cb_data = user_data; | ||
| } | ||
|
|
||
| static void zephyr_input_callback(struct input_event *evt, void *user_data) { | ||
| if (zephyr_input_cb_func) { | ||
| zephyr_input_cb_func(evt, zephyr_input_cb_data); | ||
| } | ||
| } | ||
|
|
||
| INPUT_CALLBACK_DEFINE(NULL, zephyr_input_callback, NULL); | ||
| #endif | ||
|
|
||
| #if defined(CONFIG_BOARD_ARDUINO_GIGA_R1) && defined(CONFIG_VIDEO) | ||
| #include <zephyr/kernel.h> | ||
| #include <zephyr/device.h> | ||
| #include <zephyr/drivers/clock_control.h> | ||
| #include <zephyr/logging/log.h> | ||
|
|
||
| int camera_ext_clock_enable(void) { | ||
| int ret; | ||
| uint32_t rate; | ||
| const struct device *cam_ext_clk_dev = DEVICE_DT_GET(DT_NODELABEL(pwmclock)); | ||
|
|
||
| if (!device_is_ready(cam_ext_clk_dev)) { | ||
| return -ENODEV; | ||
| } | ||
|
|
||
| ret = clock_control_on(cam_ext_clk_dev, (clock_control_subsys_t)0); | ||
| if (ret < 0) { | ||
| return ret; | ||
| } | ||
|
|
||
| ret = clock_control_get_rate(cam_ext_clk_dev, (clock_control_subsys_t)0, &rate); | ||
| if (ret < 0) { | ||
| return ret; | ||
| } | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
| SYS_INIT(camera_ext_clock_enable, POST_KERNEL, CONFIG_CLOCK_CONTROL_PWM_INIT_PRIORITY); | ||
|
|
||
| #endif | ||
|
|
||
| #if defined(CONFIG_SHARED_MULTI_HEAP) | ||
| #include <zephyr/kernel.h> | ||
| #include <zephyr/devicetree.h> | ||
| #include <zephyr/multi_heap/shared_multi_heap.h> | ||
|
|
||
| __stm32_sdram1_section static uint8_t __aligned(32) smh_pool[4 * 1024 * 1024]; | ||
|
|
||
| int smh_init(void) { | ||
| int ret = 0; | ||
| ret = shared_multi_heap_pool_init(); | ||
| if (ret != 0) { | ||
| return ret; | ||
| } | ||
|
|
||
| struct shared_multi_heap_region smh_sdram = { | ||
| .addr = (uintptr_t)smh_pool, | ||
| .size = sizeof(smh_pool), | ||
| .attr = SMH_REG_ATTR_EXTERNAL, | ||
| }; | ||
|
|
||
| ret = shared_multi_heap_add(&smh_sdram, NULL); | ||
| if (ret != 0) { | ||
| return ret; | ||
| } | ||
| return 0; | ||
| } | ||
|
|
||
| SYS_INIT(smh_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); | ||
| #endif | ||
|
|
||
| #if defined(CONFIG_BOARD_ARDUINO_PORTENTA_C33) && defined(CONFIG_LLEXT) | ||
| #include <zephyr/kernel.h> | ||
| #include <zephyr/storage/flash_map.h> | ||
|
|
||
| int maybe_flash_bootloader(void) { | ||
| // memcmp the first 256bytes of "embedded bootloader" and address 0x0 | ||
| // if they are different, flash the bootloader | ||
| const uint8_t embedded_bootloader[] = { | ||
| #include "c33_bl_patch/c33_bl.bin.inc" | ||
| }; | ||
|
|
||
| const struct flash_area *fa; | ||
| int rc; | ||
|
|
||
| rc = flash_area_open(FIXED_PARTITION_ID(mcuboot), &fa); | ||
| if (rc) { | ||
| printk("Failed to open flash area, rc %d\n", rc); | ||
| return rc; | ||
| } | ||
|
|
||
| uint8_t flash_bootloader[256]; | ||
| flash_area_read(fa, 0, flash_bootloader, 256); | ||
|
|
||
| if (memcmp(embedded_bootloader, flash_bootloader, 256) != 0) { | ||
| // flash the bootloader | ||
| rc = flash_area_erase(fa, 0, fa->fa_size); | ||
| if (rc) { | ||
| printk("Failed to erase flash area, rc %d\n", rc); | ||
| return rc; | ||
| } | ||
| flash_area_write(fa, 0, embedded_bootloader, sizeof(embedded_bootloader)); | ||
| if (rc) { | ||
| printk("Failed to write flash area, rc %d\n", rc); | ||
| return rc; | ||
| } | ||
| } | ||
soburi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return 0; | ||
| } | ||
|
|
||
| SYS_INIT(maybe_flash_bootloader, POST_KERNEL, CONFIG_FILE_SYSTEM_INIT_PRIORITY); | ||
|
|
||
| #endif | ||
|
|
||
| #if defined(CONFIG_BOARD_ARDUINO_UNO_Q) | ||
| #include "matrix.inc" | ||
|
|
||
| #include "../variants/arduino_uno_q_stm32u585xx/variant.h" | ||
| #include <stm32_ll_adc.h> | ||
| #include <zephyr/devicetree.h> | ||
|
|
||
| int analog_reference(uint8_t reference) { | ||
| uint8_t init_status; | ||
|
|
||
| /* VREF+ is connected to VDDA by default */ | ||
| const struct gpio_dt_spec spec = | ||
| GPIO_DT_SPEC_GET_BY_IDX(DT_PATH(zephyr_user), analog_switch_gpios, 0); | ||
|
|
||
| gpio_pin_configure_dt(&spec, GPIO_OUTPUT); | ||
|
|
||
| __HAL_RCC_SYSCFG_CLK_ENABLE(); | ||
| __HAL_RCC_VREF_CLK_ENABLE(); | ||
|
|
||
| HAL_SYSCFG_VREFBUF_HighImpedanceConfig(SYSCFG_VREFBUF_HIGH_IMPEDANCE_ENABLE); | ||
| HAL_SYSCFG_DisableVREFBUF(); | ||
|
|
||
| if (reference == AR_DEFAULT) { | ||
| /* VREF+ is connected to VDDA */ | ||
| gpio_pin_set_dt(&spec, 0); | ||
| return 0; | ||
| } | ||
|
|
||
| gpio_pin_set_dt(&spec, 1); | ||
|
|
||
| if (reference == AR_EXTERNAL) { | ||
| return 0; | ||
| } | ||
|
|
||
| uint32_t voltageScaling = SYSCFG_VREFBUF_VOLTAGE_SCALE3; | ||
| switch (reference) { | ||
| case AR_INTERNAL2V5: | ||
| voltageScaling = SYSCFG_VREFBUF_VOLTAGE_SCALE3; | ||
| break; | ||
| case AR_INTERNAL2V05: | ||
| voltageScaling = SYSCFG_VREFBUF_VOLTAGE_SCALE2; | ||
| break; | ||
| case AR_INTERNAL1V8: | ||
| voltageScaling = SYSCFG_VREFBUF_VOLTAGE_SCALE1; | ||
| break; | ||
| case AR_INTERNAL1V5: | ||
| voltageScaling = SYSCFG_VREFBUF_VOLTAGE_SCALE0; | ||
| break; | ||
| } | ||
|
|
||
| HAL_SYSCFG_VREFBUF_VoltageScalingConfig(voltageScaling); | ||
| init_status = HAL_SYSCFG_EnableVREFBUF(); | ||
| HAL_SYSCFG_VREFBUF_HighImpedanceConfig(SYSCFG_VREFBUF_HIGH_IMPEDANCE_DISABLE); | ||
|
|
||
| __ASSERT(init_status == HAL_OK, "ADC Conversion value may be incorrect"); | ||
|
|
||
| return init_status; | ||
| } | ||
|
|
||
| EXPORT_SYMBOL(analog_reference); | ||
|
|
||
| int disable_vrefbuf() { | ||
| // This is the safe HW configuration | ||
| return analog_reference(AR_DEFAULT); | ||
| } | ||
|
|
||
| SYS_INIT(disable_vrefbuf, POST_KERNEL, 0); | ||
| #endif | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.