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
50 changes: 50 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -742,3 +742,53 @@ ventunoq.bootloader.tool=remoteocd
ventunoq.bootloader.tool.default=remoteocd
ventunoq.bootloader.file=zephyr-{build.variant}.elf
ventunoq.bootloader.target=stm32h5f5xx

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

kit_psc3m5_evk.name=Infineon KIT_PSC3M5 EVK
kit_psc3m5_evk.build.core=arduino
kit_psc3m5_evk.build.crossprefix=arm-zephyr-eabi-
kit_psc3m5_evk.build.compiler_path={runtime.tools.arm-zephyr-eabi-1.0.1.path}/bin/

kit_psc3m5_evk.build.zephyr_target=kit_psc3m5_evk
kit_psc3m5_evk.build.zephyr_args=
kit_psc3m5_evk.build.zephyr_hals=hal_infineon
kit_psc3m5_evk.build.zephyr_toolchain=arm-zephyr-eabi
kit_psc3m5_evk.build.variant=kit_psc3m5_evk_psc3m5fds2afq1
kit_psc3m5_evk.build.release_group=psc3
kit_psc3m5_evk.build.feature_board=true

kit_psc3m5_evk.build.extra_flags=
kit_psc3m5_evk.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit
kit_psc3m5_evk.build.board=KIT_PSC3M5_EVK

kit_psc3m5_evk.menu.debug.false=Standard
kit_psc3m5_evk.menu.debug.true=Debug
kit_psc3m5_evk.menu.debug.true.build.zsk_args.debug=-debug

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

kit_psc3m5_evk.openocd_cfg=flash_sketch.cfg

kit_psc3m5_evk.upload.tool=openocd
kit_psc3m5_evk.upload.tool.default=openocd
kit_psc3m5_evk.upload.protocol=
kit_psc3m5_evk.upload.config=-f target/infineon/psc3.cfg
kit_psc3m5_evk.upload.programmer=-f interface/cmsis-dap.cfg
kit_psc3m5_evk.tools.openocd.upload.pattern.windows=cmd /C cd /D "{build.path}" && "{path}/{cmd}" {upload.verbose} -s "{path}/scripts/" -s "{path}/share/openocd/scripts/" -s "{runtime.platform.path}/variants/{build.variant}/" -f interface/cmsis-dap.cfg -f target/infineon/psc3.cfg -c "set filename0 [list \runtime.platform.path}/firmwares/zephyr-{build.variant}.hex]; set filename1 [list \build.path}/{build.project_name}.{upload.extension}]; set offset {upload.address}" -f "{runtime.platform.path}/variants/{build.variant}/openocd.cfg" "{upload.verbose}"
kit_psc3m5_evk.tools.openocd.program.pattern.windows=cmd /C cd /D "{build.path}" && "{path}/{cmd}" {program.verbose} -s "{path}/scripts/" -s "{path}/share/openocd/scripts/" -s "{runtime.platform.path}/variants/{build.variant}/" -f interface/cmsis-dap.cfg -f target/infineon/psc3.cfg -c "set filename0 [list \runtime.platform.path}/firmwares/zephyr-{build.variant}.hex]; set filename1 [list \build.path}/{build.project_name}.{upload.extension}]; set offset {upload.address}" -f "{runtime.platform.path}/variants/{build.variant}/openocd.cfg" "{program.verbose}"
kit_psc3m5_evk.upload.use_1200bps_touch=false
kit_psc3m5_evk.upload.wait_for_upload_port=false
kit_psc3m5_evk.upload.native_usb=false
kit_psc3m5_evk.tools.openocd.upload.pattern.windows=cmd /C cd /D "{build.path}" && "{path}/{cmd}" {upload.verbose} -s "{path}/scripts/" -s "{path}/share/openocd/scripts/" -s "{runtime.platform.path}/variants/{build.variant}/" -f interface/cmsis-dap.cfg -f target/infineon/psc3.cfg -c "set filename0 [file normalize {{runtime.platform.path}/firmwares/zephyr-{build.variant}.hex}]; set filename1 [file normalize {{build.path}/{build.project_name}.{upload.extension}}]; set offset {upload.address}" -f "{runtime.platform.path}/variants/{build.variant}/openocd.cfg" "{upload.verbose}"
kit_psc3m5_evk.tools.openocd.program.pattern.windows=cmd /C cd /D "{build.path}" && "{path}/{cmd}" {program.verbose} -s "{path}/scripts/" -s "{path}/share/openocd/scripts/" -s "{runtime.platform.path}/variants/{build.variant}/" -f interface/cmsis-dap.cfg -f target/infineon/psc3.cfg -c "set filename0 [file normalize {{runtime.platform.path}/firmwares/zephyr-{build.variant}.hex}]; set filename1 [file normalize {{build.path}/{build.project_name}.{upload.extension}}]; set offset {upload.address}" -f "{runtime.platform.path}/variants/{build.variant}/openocd.cfg" "{program.verbose}"

kit_psc3m5_evk.bootloader.tool=openocd
kit_psc3m5_evk.bootloader.tool.default=openocd
kit_psc3m5_evk.bootloader.file=../firmwares/zephyr-{build.variant}.hex
kit_psc3m5_evk.tools.openocd.bootloader.pattern.windows=cmd /C cd /D "{runtime.platform.path}/firmwares" && "{path}/{cmd}" {bootloader.verbose} -s "{path}/scripts/" -s "{path}/share/openocd/scripts/" -s "{runtime.platform.path}/variants/{build.variant}/" -f interface/cmsis-dap.cfg -f target/infineon/psc3.cfg -c "set filename0 [list zephyr-{build.variant}.hex]" -f "{runtime.platform.path}/variants/{build.variant}/openocd.cfg" "{bootloader.verbose}"
kit_psc3m5_evk.bootloader.target=psc3.cm33
6 changes: 6 additions & 0 deletions loader/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ struct backup_store {
extern volatile __stm32_backup_sram_section struct backup_store backup;

static int loader(const struct shell *sh) {
#if defined(CONFIG_FLASH_MAP)
const struct flash_area *fa;
int rc;

Expand All @@ -138,6 +139,7 @@ static int loader(const struct shell *sh) {
recoverable_error_led();
return rc;
}
#endif

#if defined(CONFIG_OTA)
try_ota_update(fa);
Expand All @@ -146,12 +148,16 @@ static int loader(const struct shell *sh) {
uintptr_t base_addr = DT_PARTITION_ADDR(DT_NODELABEL(user_sketch));

char header[SKETCH_HEADER_LEN];
#if defined(CONFIG_FLASH_MAP)
rc = flash_area_read(fa, 0, header, sizeof(header));
if (rc) {
printk("Failed to read header, rc %d\n", rc);
recoverable_error_led();
return rc;
}
#else
memcpy(header, (const void *)base_addr, sizeof(header));
#endif

bool sketch_valid = true;
struct sketch_header_v1 *sketch_hdr = (struct sketch_header_v1 *)(header + 7);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#
# Copyright (c) Arduino s.r.l. and/or its affiliated companies
#
# SPDX-License-Identifier: Apache-2.0
#
# NOTE: The board defconfig already provides:
# CONFIG_ARM_MPU=y
# CONFIG_HW_STACK_PROTECTION=y
# CONFIG_TRUSTED_EXECUTION_SECURE=y
# CONFIG_GPIO=y
# CONFIG_CLOCK_CONTROL=y
# CONFIG_CONSOLE=y
# CONFIG_UART_CONSOLE=y
# CONFIG_SERIAL=y
# CONFIG_ARM_TRUSTZONE_M=y

# This board only exposes 64KB of secure RAM. The loader's default
# heap/stack sizes (32KB each) alone consume all of it, overflowing
# RAM. Shrink them to fit.
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_HEAP_MEM_POOL_SIZE=16384
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=1024

# Default LLEXT heap (32KB) plus the above still leaves almost no headroom
# for the kernel/drivers on this 64KB chip, corrupting RAM at boot. Shrink
# it too; small sketches don't need a large extension heap.
CONFIG_LLEXT_HEAP_SIZE=16

CONFIG_LLEXT_STORAGE_WRITABLE=n

CONFIG_CAN=y

# OpenOCD programs internal flash; the loader reads the sketch directly through
# its memory-mapped secure address. The board's flash controller is disabled,
# so runtime flash operations (including flash-map-based OTA) are unavailable.
CONFIG_FLASH=n
CONFIG_FLASH_MAP=n
Comment thread
djaumann marked this conversation as resolved.

CONFIG_SHARED_INTERRUPTS=y

CONFIG_BOOT_BANNER=n

CONFIG_ARM_MPU=n
CONFIG_HW_STACK_PROTECTION=n

CONFIG_BOOTLOADER_MCUBOOT=n
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright (c) Arduino s.r.l. and/or its affiliated companies
*
* SPDX-License-Identifier: Apache-2.0
*/

/*
* Minimal Arduino overlay for the Infineon KIT_PSC3M5_EVK.
*
* This board defines real GPIOs and the UART node in the upstream Zephyr DTS:
* - user LED aliases: user_led0 -> GPIO port 8 pin 5, user_led1 -> GPIO port 8 pin 4
* - user buttons: SW_1 -> GPIO port 5 pin 0, SW_2 -> GPIO port 2 pin 0
* - serial console: uart3 -> scb3 on pins P6_3/P6_2
*
* The upstream board DTS does not define an Arduino Uno R3 header or a PWM/ADC
* alias table, so this file maps the board-defined GPIOs directly instead of
* inventing a non-existent Arduino header pin map.
*/

&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

/* Offset within flash0; keep the first 128 KiB for the loader. */
user_sketch: partition@20000 {
label = "user_sketch";
reg = <0x20000 DT_SIZE_K(56)>;
};
};
};

/ {
zephyr,user {
digital-pin-gpios = <&gpio_prt5 0 0>, /* D0 / SW_1 */
<&gpio_prt2 0 0>, /* D1 / SW_2 */
<&gpio_prt8 5 GPIO_ACTIVE_LOW>, /* D2 / LED_0 */
<&gpio_prt8 4 GPIO_ACTIVE_LOW>; /* D3 / LED_1 */

builtin-led-gpios = <&gpio_prt8 5 GPIO_ACTIVE_LOW>,
<&gpio_prt8 4 GPIO_ACTIVE_LOW>;

serials = <&uart3>;
cans = <&can1>;
};
};

&uart3 {
status = "okay";
};

&rtc0 {
status = "okay";
};
12 changes: 12 additions & 0 deletions variants/kit_psc3m5_evk_psc3m5fds2afq1/openocd.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
targets psc3.cm33

Check warning on line 1 in variants/kit_psc3m5_evk_psc3m5fds2afq1/openocd.cfg

View workflow job for this annotation

GitHub Actions / Scan code for licenses

Missing license and copyright information

telnet_port disabled
init
reset init
halt
flash write_image erase "${filename0}"
if {[info exists filename1] && [string length $filename1] > 0} {
flash write_image erase "${filename1}" ${offset} bin
}
reset run
shutdown
63 changes: 63 additions & 0 deletions variants/kit_psc3m5_evk_psc3m5fds2afq1/variant.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright (c) Arduino s.r.l. and/or its affiliated companies
*
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#ifndef __PINS_ARDUINO__
#define __PINS_ARDUINO__

#include <stdint.h>

/*
* Minimal Arduino-style pin map for the Infineon KIT_PSC3M5_EVK.
*
* This board exposes its real GPIOs in the Zephyr DTS and we mapped the
* Arduino-style aliases to the actual board-defined GPIOs in the overlay.
* The mapping here is intentionally conservative and matches the board's
* runtime GPIO layout without inventing a non-existent Uno R3 header.
*/

#define PINS_COUNT (4u)
Comment thread
djaumann marked this conversation as resolved.
#define NUM_DIGITAL_PINS (4u)
#define NUM_ANALOG_INPUTS (0u)
#define NUM_ANALOG_OUTPUTS (0u)

#define PIN_LED (2u)
#define LED_BUILTIN PIN_LED

/* Arduino-style digital pins used by the board overlay */
#define PIN_D0 (0u)
#define PIN_D1 (1u)
#define PIN_D2 (2u)
#define PIN_D3 (3u)

/*
* If the board gains ADC-capable GPIOs in the future, these can be mapped here
* and exposed as A0..A7 in the same way as the rest of the ArduinoCore-zephyr
* variants. For now the board DTS only exposes the user GPIOs/LEDs and UART.
*/
#define PIN_A0 (0u)
#define PIN_A1 (1u)
#define PIN_A2 (2u)
#define PIN_A3 (3u)
#define PIN_A4 (4u)
#define PIN_A5 (5u)
#define PIN_A6 (6u)
#define PIN_A7 (7u)

#define PIN_SERIAL_RX (0u)
#define PIN_SERIAL_TX (1u)

#define SERIAL_HOWMANY (1u)
#define SERIAL1_TX (1u)
#define SERIAL1_RX (0u)

#define SERIAL_PORT_HARDWARE Serial1
#define SERIAL_PORT_MONITOR Serial

#define WIRE_HOWMANY (0u)

#endif /* __PINS_ARDUINO__ */
Loading