Skip to content
Open
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 @@ -127,6 +127,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 @@ -136,6 +137,7 @@ static int loader(const struct shell *sh) {
printk("Failed to open flash area, rc %d\n", rc);
return rc;
}
#endif

#if defined(CONFIG_OTA)
try_ota_update(fa);
Expand All @@ -144,11 +146,15 @@ 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);
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,52 @@
#
# Copyright (c) Arduino s.r.l. and/or its affiliated companies
#
# SPDX-License-Identifier: Apache-2.0
#

# Keep the board defaults and only add the minimum Arduino-required features.
CONFIG_ARM_MPU=y

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is later turned off in line 44?

# CONFIG_HW_STACK_PROTECTION=y
CONFIG_TRUSTED_EXECUTION_SECURE=y
CONFIG_ARM_TRUSTZONE_M=y

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line 10 and 11,(CONFIG_TRUSTED_EXECUTION_SECURE=y
CONFIG_ARM_TRUSTZONE_M=y) can be removed as the board defconfig already provides these values and it is redundant.
or can add a note/comment like (line number 6-13)) psocedge conf file (https://github.com/Infineon/ArduinoCore-zephyr/blob/ba7cb88f33a62b46bce8684d4bbf73a9601a2a29/variants/kit_pse84_ai_pse846gps2dbzc4a_m33/kit_pse84_ai_pse846gps2dbzc4a_m33.conf)


# 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_GPIO=y
CONFIG_CLOCK_CONTROL=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_CAN=y

# The board's QSPI/flash controller is not provided by the current Zephyr tree
# in a way that exposes the flash_map APIs required by the Arduino loader.
# Disable this so the loader build does not reference missing symbols.
CONFIG_FLASH=n
CONFIG_FLASH_MAP=n
Comment on lines +37 to +38

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also duplicated again 47, 48


CONFIG_SHARED_INTERRUPTS=y

CONFIG_BOOT_BANNER=n

CONFIG_ARM_MPU=n
CONFIG_HW_STACK_PROTECTION=n

CONFIG_FLASH=n
CONFIG_FLASH_MAP=n

CONFIG_BUILD_OUTPUT_BIN=n

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you reconsider CONFIG_BUILD_OUTPUT_BIN=n here?
It conflicts with the zephyr default and shouldn't be needed since this board flashes the .hex. Worth rechecking against the psoc edge, which doesn't set it.


CONFIG_BOOTLOADER_MCUBOOT=n
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* 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>;

user_sketch: partition@10010000 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

user_sketch offset 0x10010000 is 256 mb, looks like it is out of bounds (far beyond flash0's declared 256 KB). CONFIG_FLASH_MAP=n disables the range check.

can you check again this logic?

label = "user_sketch";
reg = <0x10010000 DT_SIZE_K(56)>;
};
};
};

/ {
zephyr,user {
/* Execute the sketch through the address used by the Arduino uploader. */
sketch-runtime-address = <0x22010000>;

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

Comment on lines +38 to +42

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

digital-pin-gpios = <&gpio_prt5 0 0>, <&gpio_prt2 0 0>,
<&gpio_prt8 5 GPIO_ACTIVE_LOW>, <&gpio_prt8 4 GPIO_ACTIVE_LOW>;

AI is suggesting me something like so that polarity is maintained. cant test that since I don't have a board. Can you have look on that? AI could be wrong also here

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)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How this value is defined?

#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