From 4655e65796cb8c0f9af89db206f0a205dedc5886 Mon Sep 17 00:00:00 2001 From: Aleksander Kaminski Date: Mon, 24 Jun 2024 17:00:57 +0200 Subject: [PATCH] Add armv8m33-mcxn94x-frdm target JIRA: RTOS-881 --- .../armv8m33-mcxn94x-frdm/board_config.h | 159 ++++++++++++++++++ _projects/armv8m33-mcxn94x-frdm/build.project | 16 ++ _targets/build.project.armv8m33-mcxn94x | 113 +++++++++++++ libphoenix | 2 +- phoenix-rtos-build | 2 +- phoenix-rtos-devices | 2 +- phoenix-rtos-filesystems | 2 +- phoenix-rtos-hostutils | 2 +- phoenix-rtos-kernel | 2 +- phoenix-rtos-utils | 2 +- plo | 2 +- 11 files changed, 296 insertions(+), 8 deletions(-) create mode 100644 _projects/armv8m33-mcxn94x-frdm/board_config.h create mode 100644 _projects/armv8m33-mcxn94x-frdm/build.project create mode 100644 _targets/build.project.armv8m33-mcxn94x diff --git a/_projects/armv8m33-mcxn94x-frdm/board_config.h b/_projects/armv8m33-mcxn94x-frdm/board_config.h new file mode 100644 index 00000000..5cc5800e --- /dev/null +++ b/_projects/armv8m33-mcxn94x-frdm/board_config.h @@ -0,0 +1,159 @@ +/* + * Phoenix-RTOS + * + * Board config for armv8m33-mcxn94x-frdm + * + * Copyright 2024 Phoenix Systems + * Author: Aleksander Kaminski + * + * This file is part of Phoenix-RTOS. + * + * %LICENSE% + */ + +#ifndef _BOARD_CONFIG_H_ +#define _BOARD_CONFIG_H_ + + +/* + * libpseudodev and libposixsrv shall be used exclusively, libpseudodev uses + * less resources, but libposixsrv provides POSIX support and may be resource + * hungry, by default libposixsrv is enabled. + */ + +// #define PSEUDODEV 1 +#define BUILTIN_POSIXSRV 1 +#define BUILTIN_DUMMYFS 1 + +/* plo params */ + +#define RAM_ADDR 0x20000000 +#define RAM_BANK_SIZE (384 * 1024) +#define UART_MAX_CNT 10 + + +/* Peripherals */ + +/* ROSC */ +#define ROSC_EXTALCAP_PF 12 /* 0-30 pF */ +#define ROSC_CAP_PF 12 /* 0-30 pF */ +#define ROSC_AMP_GAIN 0 /* 0-3 */ + +/* SOSC */ +#define SOSC_FREQ (24 * 1000 * 1000) + +/* FlexComm configuration options */ +#define FLEXCOMM_NONE 0 +#define FLEXCOMM_UART 1 +#define FLEXCOMM_SPI 2 +#define FLEXCOMM_I2C 3 +#define FLEXCOMM_UARTI2C 7 + +/* FlexComm selections */ +#define FLEXCOMM0_SEL FLEXCOMM_NONE +#define FLEXCOMM1_SEL FLEXCOMM_NONE +#define FLEXCOMM2_SEL FLEXCOMM_NONE +#define FLEXCOMM3_SEL FLEXCOMM_NONE +#define FLEXCOMM4_SEL FLEXCOMM_UART +#define FLEXCOMM5_SEL FLEXCOMM_NONE +#define FLEXCOMM6_SEL FLEXCOMM_NONE +#define FLEXCOMM7_SEL FLEXCOMM_NONE +#define FLEXCOMM8_SEL FLEXCOMM_NONE +#define FLEXCOMM9_SEL FLEXCOMM_NONE + +#define FLEXCOMM0_BASE ((void *)0x40092000) +#define FLEXCOMM1_BASE ((void *)0x40093000) +#define FLEXCOMM2_BASE ((void *)0x40094000) +#define FLEXCOMM3_BASE ((void *)0x40095000) +#define FLEXCOMM4_BASE ((void *)0x400b4000) +#define FLEXCOMM5_BASE ((void *)0x400b5000) +#define FLEXCOMM6_BASE ((void *)0x400b6000) +#define FLEXCOMM7_BASE ((void *)0x400b7000) +#define FLEXCOMM8_BASE ((void *)0x400b8000) +#define FLEXCOMM9_BASE ((void *)0x400b9000) + +#define FLEXCOMM0_IRQ lp_flexcomm0_irq +#define FLEXCOMM1_IRQ lp_flexcomm1_irq +#define FLEXCOMM2_IRQ lp_flexcomm2_irq +#define FLEXCOMM3_IRQ lp_flexcomm3_irq +#define FLEXCOMM4_IRQ lp_flexcomm4_irq +#define FLEXCOMM5_IRQ lp_flexcomm5_irq +#define FLEXCOMM6_IRQ lp_flexcomm6_irq +#define FLEXCOMM7_IRQ lp_flexcomm7_irq +#define FLEXCOMM8_IRQ lp_flexcomm8_irq +#define FLEXCOMM9_IRQ lp_flexcomm9_irq + +#define UART_CONSOLE 4 +#define UART_CLK 12000000 /* FRO_12M */ + +#define UART0_BAUDRATE 115200 +#define UART0_BUFFSZ 512 +#define UART0_RX_PIN -1 +#define UART0_TX_PIN -1 +#define UART0_RX_ALT -1 +#define UART0_TX_ALT -1 + +#define UART1_BAUDRATE 115200 +#define UART1_BUFFSZ 512 +#define UART1_RX_PIN -1 +#define UART1_TX_PIN -1 +#define UART1_RX_ALT -1 +#define UART1_TX_ALT -1 + +#define UART2_BAUDRATE 115200 +#define UART2_BUFFSZ 512 +#define UART2_RX_PIN -1 +#define UART2_TX_PIN -1 +#define UART2_RX_ALT -1 +#define UART2_TX_ALT -1 + +#define UART3_BAUDRATE 115200 +#define UART3_BUFFSZ 512 +#define UART3_RX_PIN -1 +#define UART3_TX_PIN -1 +#define UART3_RX_ALT -1 +#define UART3_TX_ALT -1 + +#define UART4_BAUDRATE 115200 +#define UART4_BUFFSZ 512 +#define UART4_RX_PIN pctl_pin_p1_8 +#define UART4_TX_PIN pctl_pin_p1_9 +#define UART4_RX_ALT 2 +#define UART4_TX_ALT 2 + +#define UART5_BAUDRATE 115200 +#define UART5_BUFFSZ 512 +#define UART5_RX_PIN -1 +#define UART5_TX_PIN -1 +#define UART5_RX_ALT -1 +#define UART5_TX_ALT -1 + +#define UART6_BAUDRATE 115200 +#define UART6_BUFFSZ 512 +#define UART6_RX_PIN -1 +#define UART6_TX_PIN -1 +#define UART6_RX_ALT -1 +#define UART6_TX_ALT -1 + +#define UART7_BAUDRATE 115200 +#define UART7_BUFFSZ 512 +#define UART7_RX_PIN -1 +#define UART7_TX_PIN -1 +#define UART7_RX_ALT -1 +#define UART7_TX_ALT -1 + +#define UART8_BAUDRATE 115200 +#define UART8_BUFFSZ 512 +#define UART8_RX_PIN -1 +#define UART8_TX_PIN -1 +#define UART8_RX_ALT -1 +#define UART8_TX_ALT -1 + +#define UART9_BAUDRATE 115200 +#define UART9_BUFFSZ 512 +#define UART9_RX_PIN -1 +#define UART9_TX_PIN -1 +#define UART9_RX_ALT -1 +#define UART9_TX_ALT -1 + +#endif diff --git a/_projects/armv8m33-mcxn94x-frdm/build.project b/_projects/armv8m33-mcxn94x-frdm/build.project new file mode 100644 index 00000000..e0a73f4e --- /dev/null +++ b/_projects/armv8m33-mcxn94x-frdm/build.project @@ -0,0 +1,16 @@ +#!/bin/bash +# +# Shell script for building armv7m7-imxrt117x-evk project +# +# Copyright 2022 Phoenix Systems +# Author: Lukasz Kosinski +# + +[ "${BASH_SOURCE[0]}" -ef "$0" ] && echo "You should source this script, not execute it!" && exit 1 + +: "${WATCHDOG:=0}" +export WATCHDOG + +b_image_project () { + b_log "The images have been built for the ${TARGET} platform" +} diff --git a/_targets/build.project.armv8m33-mcxn94x b/_targets/build.project.armv8m33-mcxn94x new file mode 100644 index 00000000..411fcf3f --- /dev/null +++ b/_targets/build.project.armv8m33-mcxn94x @@ -0,0 +1,113 @@ +#!/bin/bash +# +# Shell script for building armv8m33-mcxn94x project +# +# Copyright 2018, 2019, 2020, 2024 Phoenix Systems +# Author: Kaja Swat, Aleksander Kaminski, Pawel Pisarczyk, Lukasz Kosinski +# +[ "${BASH_SOURCE[0]}" -ef "$0" ] && echo "You should source this script, not execute it!" && exit 1 + +. "_targets/build.common" + +CROSS=arm-phoenix- + +export BUSYBOX_CONFIG=$(realpath "busybox_config") +export DROPBEAR_CUSTOM_CFLAGS="-DLTC_NO_BSWAP" +export PSH_DEFUSRPWDHASH="0B1ANiYi45IhxkfmUW155/GBd4IRE=" + +# +# Ports configuration +# +export PORTS_BUSYBOX=n +export PORTS_PCRE=n +export PORTS_OPENSSL=n +export PORTS_LIGHTTPD=n +export PORTS_DROPBEAR=n +export PORTS_LUA=n +export PORTS_LZO=n +export PORTS_OPENVPN=n +export PORTS_JANSSON=n +export PORTS_CURL=n + + +# +# Platform dependent parameters +# +SIZE_PAGE=$((0x200)) +PAGE_MASK=$((0xfffffe00)) + + +# +# Project specific build +# + +BOOT_DEVICE="flash0" +NAME_USER_SCRIPT="user.plo" +OFFS_USER_SCRIPT=$((0xc800)) +MAGIC_USER_SCRIPT=$((0xdabaabad)) +KERNEL_OFFS=$((0xd000)) + + +# Physical kernel address +KERNEL_PHBASE=$((0)) # flash0 start address +KERNEL_PHOFFS=$KERNEL_OFFS +export KERNEL_PHADDR=$(printf "%08x" $(($KERNEL_PHBASE + KERNEL_PHOFFS))) + +# All data/code maps need to be cacheable to allow unaligned accesses + +# Pre-init script is launched before user script +PREINIT_SCRIPT=( + "map flash0 0x00000000 0x00100000 rxcb" + "map flash1 0x00100000 0x00200000 rxcb" + "map ramx 0x14000000 0x14020000 rxcb" + "map ram 0x20000000 0x20070000 rwxcb" # RAM A ... RAM H + "map io 0x40000000 0x80000000 rw" + "phfs flash0 2.0 raw" + "phfs flash1 2.1 raw" + "phfs ramdev 4.0 raw" + "console 0.4") + + +# Production user script contains applications to run Phoenix-RTOS +USER_SCRIPT=( + "kernelimg ${BOOT_DEVICE}" + "app ${BOOT_DEVICE} -x mcxn94x-multi flash0 ram;io" + "app ${BOOT_DEVICE} -x psh flash0 ram" + "wait 2000" + "go!") + +# Example of user dev script which call remotely script +DEV_USER_SCRIPT=( + "echo on" + "wait 3000") + + +REMOTE_USER_SCRIPT=("5a5aa5a5") + + +b_build_project() { + b_log "Building user applications" + make -C "_user" all install +} + + +b_build_target() { + b_log "Building $TARGET project" + b_log "Building phoenix-rtos-loader" + + b_mkscript_preinit + + make -C plo all +} + + +b_image_target() { + b_mkscript_user "${USER_SCRIPT[@]}" + b_prod_image + b_dev_image +} + +b_test_target() { + b_log "Build and install tests in the phoenix-rtos filesystem" + make -C "phoenix-rtos-tests" all install +} diff --git a/libphoenix b/libphoenix index 685bf804..6cc0c0e4 160000 --- a/libphoenix +++ b/libphoenix @@ -1 +1 @@ -Subproject commit 685bf804d6aa5212e43da716b474cafec2ddbb33 +Subproject commit 6cc0c0e4601cca15da03fa5ff5a5009c6ce75d9d diff --git a/phoenix-rtos-build b/phoenix-rtos-build index a30f728e..4fe7a966 160000 --- a/phoenix-rtos-build +++ b/phoenix-rtos-build @@ -1 +1 @@ -Subproject commit a30f728e433b7e7d994e37278c5bbdbab0de60d2 +Subproject commit 4fe7a9662479f6838215c842a9bc8ccd391c1e85 diff --git a/phoenix-rtos-devices b/phoenix-rtos-devices index 4d8edcc3..1725d307 160000 --- a/phoenix-rtos-devices +++ b/phoenix-rtos-devices @@ -1 +1 @@ -Subproject commit 4d8edcc371f5ac55cd58a9b526a55f1b9acba748 +Subproject commit 1725d30797e774562ed875346b047d6f6d0f70ae diff --git a/phoenix-rtos-filesystems b/phoenix-rtos-filesystems index ae4483ad..29bb42f0 160000 --- a/phoenix-rtos-filesystems +++ b/phoenix-rtos-filesystems @@ -1 +1 @@ -Subproject commit ae4483ad21e5c1ffc1be09c054dc1da56639d3c8 +Subproject commit 29bb42f0122c62e4dbf911ccaaff2f22c755171d diff --git a/phoenix-rtos-hostutils b/phoenix-rtos-hostutils index 663aa4ad..df5f463a 160000 --- a/phoenix-rtos-hostutils +++ b/phoenix-rtos-hostutils @@ -1 +1 @@ -Subproject commit 663aa4adc0f4423216130576f0b579ef8d6812f3 +Subproject commit df5f463a91d2790bda884641ca0d9ccd0b5ee57a diff --git a/phoenix-rtos-kernel b/phoenix-rtos-kernel index 764a9df1..19d7699f 160000 --- a/phoenix-rtos-kernel +++ b/phoenix-rtos-kernel @@ -1 +1 @@ -Subproject commit 764a9df1232fb64ef5ac53544e506f22b9b0f2d3 +Subproject commit 19d7699f031ad6aa3d6fef2645329eb3ad35eb72 diff --git a/phoenix-rtos-utils b/phoenix-rtos-utils index ab4e58b6..fbdd6aaf 160000 --- a/phoenix-rtos-utils +++ b/phoenix-rtos-utils @@ -1 +1 @@ -Subproject commit ab4e58b6fc86fd6645190165609d73e17b76ad0f +Subproject commit fbdd6aaf3f01f6b58bf6ff0f34a4312a0fb25644 diff --git a/plo b/plo index 8bead601..fde217d0 160000 --- a/plo +++ b/plo @@ -1 +1 @@ -Subproject commit 8bead601013f7fd58515588157d86775e7fdee29 +Subproject commit fde217d0bc6da2d41ecf751b6949f01a045ba198