-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request tock#4300 from OxidosAutomotive/psoc6
boards: add initial code for CY8CPROTO-062-4343W
- Loading branch information
Showing
21 changed files
with
6,046 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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,14 @@ | ||
# Licensed under the Apache License, Version 2.0 or the MIT License. | ||
# SPDX-License-Identifier: Apache-2.0 OR MIT | ||
# Copyright OxidOS Automotive SRL 2025. | ||
|
||
include = [ | ||
"../../cargo/tock_flags.toml", | ||
"../../cargo/unstable_flags.toml", | ||
] | ||
|
||
[build] | ||
target = "thumbv6m-none-eabi" | ||
|
||
[unstable] | ||
config-include = true |
This file contains 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,26 @@ | ||
# Licensed under the Apache License, Version 2.0 or the MIT License. | ||
# SPDX-License-Identifier: Apache-2.0 OR MIT | ||
# Copyright OxidOS Automotive 2025 SRL. | ||
|
||
[package] | ||
name = "cy8cproto_62_4243_w" | ||
version.workspace = true | ||
authors.workspace = true | ||
edition.workspace = true | ||
build = "../build.rs" | ||
|
||
[dependencies] | ||
cortexm0p = { path = "../../arch/cortex-m0p" } | ||
kernel = { path = "../../kernel" } | ||
psoc62xa = { path = "../../chips/psoc62xa" } | ||
components = { path = "../components" } | ||
|
||
capsules-core = { path = "../../capsules/core" } | ||
capsules-extra = { path = "../../capsules/extra" } | ||
capsules-system = { path = "../../capsules/system" } | ||
|
||
[build-dependencies] | ||
tock_build_scripts = { path = "../build_scripts" } | ||
|
||
[lints] | ||
workspace = true |
This file contains 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,27 @@ | ||
# Licensed under the Apache License, Version 2.0 or the MIT License. | ||
# SPDX-License-Identifier: Apache-2.0 OR MIT | ||
# Copyright OxidOS Automotive 2025 SRL. | ||
|
||
include ../Makefile.common | ||
|
||
OPENOCD_OPTIONS= -s ${OPENOCD_ROOT}/scripts -f openocd.cfg | ||
# Define the path to the TBF file to flash an application | ||
APP= | ||
KERNEL=$(TOCK_ROOT_DIRECTORY)/target/$(TARGET)/release/$(PLATFORM).elf | ||
KERNEL_WITH_APP=$(TOCK_ROOT_DIRECTORY)/target/$(TARGET)/release/$(PLATFORM)-app.elf | ||
|
||
install: flash | ||
.PHONY: install | ||
|
||
flash: release | ||
${OPENOCD_ROOT}/bin/openocd $(OPENOCD_OPTIONS) -c "program $(KERNEL); verify_image $(KERNEL); reset; shutdown" | ||
.PHONY: flash | ||
|
||
.PHONY: program | ||
program: release | ||
ifeq ($(APP),) | ||
$(error Please define the APP variable with the TBF file to flash an application) | ||
endif | ||
arm-none-eabi-objcopy --set-section-flags .apps=LOAD,ALLOC $(KERNEL) $(KERNEL_WITH_APP) | ||
arm-none-eabi-objcopy --update-section .apps=$(APP) $(KERNEL_WITH_APP) | ||
${OPENOCD_ROOT}/bin/openocd $(OPENOCD_OPTIONS) -c "program $(KERNEL_WITH_APP); verify_image $(KERNEL_WITH_APP); reset; shutdown" |
This file contains 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,32 @@ | ||
Cypress CY8CPROTO-062-4343W | ||
=========================== | ||
|
||
<img src="https://www.infineon.com/export/sites/default/_images/product/evaluation-boards/cypress-boards/CY8CPROTO-062-4343W_0.jpg_1361197165.jpg" width="40%"> | ||
|
||
The [Cypress CY8CPROTO-062-4343W](https://www.infineon.com/cms/en/product/evaluation-boards/cy8cproto-062-4343w/) is a prototyping board based on the PSoC 62xA SoC. | ||
|
||
## Getting started | ||
|
||
1. Download the [Infineon Customized OpenOCD](https://github.com/Infineon/openocd/releases/latest) | ||
2. Set OPENOCD_ROOT to the directory from extracted archive. | ||
3. Connect the computer to the `KitProg3` USB connector. | ||
4. Add the udev rule for `KitProg3`: | ||
```bash | ||
$ sudo bash -c "echo 'ATTRS{idVendor}==\"04b4\", ATTRS{idProduct}==\"f155\", MODE=\"0666\"' > /etc/udev/rules.d/99-kitprog3.rules" | ||
``` | ||
|
||
## Flashing the kernel | ||
|
||
The kernel can be programmed by going inside the board's directory and running: | ||
```bash | ||
$ make flash | ||
``` | ||
|
||
## Flashing an app | ||
|
||
Apps are built out-of-tree. Once an app is built, you must add the path to the generated TBF in the Makefile (APP variable), then run: | ||
```bash | ||
$ make program | ||
``` | ||
|
||
This will generate a new ELF file that can be deployed on the CY8CPROTO-062-4343W via gdb and OpenOCD. |
This file contains 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,14 @@ | ||
/* Licensed under the Apache License, Version 2.0 or the MIT License. */ | ||
/* SPDX-License-Identifier: Apache-2.0 OR MIT */ | ||
/* Copyright Oxidos Automotive 2025 SRL. */ | ||
|
||
MEMORY | ||
{ | ||
rom (rx) : ORIGIN = 0x10000000, LENGTH = 1M | ||
prog (rx) : ORIGIN = 0x10100000, LENGTH = 1M | ||
ram (rwx) : ORIGIN = 0x08000000, LENGTH = 1M | ||
} | ||
|
||
ENTRY(initialize_ram_jump_to_main) | ||
|
||
INCLUDE tock_kernel_layout.ld |
This file contains 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,8 @@ | ||
# Licensed under the Apache License, Version 2.0 or the MIT License. | ||
# SPDX-License-Identifier: Apache-2.0 OR MIT | ||
# Copyright OxidOS Automotive 2025 SRL. | ||
# | ||
# OpenOCD configuration for the CY8CPROTO-062 development board | ||
|
||
source [find interface/kitprog3.cfg] | ||
source [find target/psoc6_2m.cfg] |
This file contains 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,64 @@ | ||
// Licensed under the Apache License, Version 2.0 or the MIT License. | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
// Copyright OxidOS Automotive 2025 SRL. | ||
|
||
use core::panic::PanicInfo; | ||
use kernel::utilities::cells::OptionalCell; | ||
|
||
use psoc62xa::gpio::GpioPin; | ||
use psoc62xa::scb::Scb; | ||
|
||
use kernel::debug::{self, IoWrite}; | ||
use kernel::hil::led::LedHigh; | ||
|
||
use crate::CHIP; | ||
use crate::PROCESSES; | ||
use crate::PROCESS_PRINTER; | ||
|
||
/// Writer is used by kernel::debug to panic message to the serial port. | ||
pub struct Writer { | ||
scb: OptionalCell<&'static Scb<'static>>, | ||
} | ||
|
||
impl Writer { | ||
pub fn set_scb(&self, scb: &'static Scb) { | ||
self.scb.set(scb); | ||
} | ||
} | ||
|
||
impl core::fmt::Write for Writer { | ||
fn write_str(&mut self, s: &str) -> core::fmt::Result { | ||
self.scb.map(|scb| scb.transmit_uart_sync(s.as_bytes())); | ||
Ok(()) | ||
} | ||
} | ||
|
||
impl IoWrite for Writer { | ||
fn write(&mut self, buf: &[u8]) -> usize { | ||
self.scb.map(|scb| scb.transmit_uart_sync(buf)); | ||
buf.len() | ||
} | ||
} | ||
|
||
pub static mut WRITER: Writer = Writer { | ||
scb: OptionalCell::empty(), | ||
}; | ||
|
||
/// Panic handler for the CY8CPROTO-062-4343 board. | ||
#[panic_handler] | ||
pub unsafe fn panic_fmt(panic_info: &PanicInfo) -> ! { | ||
use core::ptr::{addr_of, addr_of_mut}; | ||
let writer = &mut *addr_of_mut!(WRITER); | ||
let led_kernel_pin = &GpioPin::new(psoc62xa::gpio::PsocPin::P13_7); | ||
let led = &mut LedHigh::new(led_kernel_pin); | ||
|
||
debug::panic( | ||
&mut [led], | ||
writer, | ||
panic_info, | ||
&cortexm0p::support::nop, | ||
&*addr_of!(PROCESSES), | ||
&*addr_of!(CHIP), | ||
&*addr_of!(PROCESS_PRINTER), | ||
); | ||
} |
Oops, something went wrong.