-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
S32K344 Basic porting : LED and FINSH
- Loading branch information
Showing
450 changed files
with
1,664,473 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# S32K3 BSP 说明 | ||
|
||
## S32K344 | ||
|
||
使用 S32 Design Studio for S32 Platform 3.5 配置 MCAL 基础工程: | ||
|
||
- led -- PC25 | ||
- finsh -- LPUART3(PD3-Rx, PD2-Tx) | ||
|
||
使用gcc编译 |
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,135 @@ | ||
|
||
# | ||
# RT-Thread Kernel | ||
# | ||
CONFIG_RT_NAME_MAX=8 | ||
# CONFIG_RT_USING_ARCH_DATA_TYPE is not set | ||
CONFIG_RT_USING_NANO=y | ||
# CONFIG_RT_USING_AMP is not set | ||
# CONFIG_RT_USING_SMP is not set | ||
CONFIG_RT_CPUS_NR=1 | ||
CONFIG_RT_ALIGN_SIZE=8 | ||
# CONFIG_RT_THREAD_PRIORITY_8 is not set | ||
CONFIG_RT_THREAD_PRIORITY_32=y | ||
# CONFIG_RT_THREAD_PRIORITY_256 is not set | ||
CONFIG_RT_THREAD_PRIORITY_MAX=32 | ||
CONFIG_RT_TICK_PER_SECOND=1000 | ||
CONFIG_RT_USING_HOOK=y | ||
CONFIG_RT_HOOK_USING_FUNC_PTR=y | ||
# CONFIG_RT_USING_HOOKLIST is not set | ||
CONFIG_RT_USING_IDLE_HOOK=y | ||
CONFIG_RT_IDLE_HOOK_LIST_SIZE=4 | ||
CONFIG_IDLE_THREAD_STACK_SIZE=1024 | ||
CONFIG_RT_USING_TIMER_SOFT=y | ||
CONFIG_RT_TIMER_THREAD_PRIO=4 | ||
CONFIG_RT_TIMER_THREAD_STACK_SIZE=1024 | ||
# CONFIG_RT_USING_TIMER_ALL_SOFT is not set | ||
# CONFIG_RT_USING_CPU_USAGE_TRACER is not set | ||
|
||
# | ||
# kservice optimization | ||
# | ||
# CONFIG_RT_USING_TINY_FFS is not set | ||
# end of kservice optimization | ||
|
||
# | ||
# klibc optimization | ||
# | ||
# CONFIG_RT_KLIBC_USING_STDLIB is not set | ||
# CONFIG_RT_KLIBC_USING_TINY_SIZE is not set | ||
# CONFIG_RT_KLIBC_USING_PRINTF_LONGLONG is not set | ||
# end of klibc optimization | ||
|
||
CONFIG_RT_USING_DEBUG=y | ||
CONFIG_RT_DEBUGING_ASSERT=y | ||
CONFIG_RT_DEBUGING_COLOR=y | ||
CONFIG_RT_DEBUGING_CONTEXT=y | ||
# CONFIG_RT_DEBUGING_AUTO_INIT is not set | ||
CONFIG_RT_USING_OVERFLOW_CHECK=y | ||
|
||
# | ||
# Inter-Thread communication | ||
# | ||
CONFIG_RT_USING_SEMAPHORE=y | ||
CONFIG_RT_USING_MUTEX=y | ||
CONFIG_RT_USING_EVENT=y | ||
CONFIG_RT_USING_MAILBOX=y | ||
CONFIG_RT_USING_MESSAGEQUEUE=y | ||
# CONFIG_RT_USING_MESSAGEQUEUE_PRIORITY is not set | ||
# CONFIG_RT_USING_SIGNALS is not set | ||
# end of Inter-Thread communication | ||
|
||
# | ||
# Memory Management | ||
# | ||
CONFIG_RT_USING_MEMPOOL=y | ||
CONFIG_RT_USING_SMALL_MEM=y | ||
# CONFIG_RT_USING_SLAB is not set | ||
# CONFIG_RT_USING_MEMHEAP is not set | ||
CONFIG_RT_USING_SMALL_MEM_AS_HEAP=y | ||
# CONFIG_RT_USING_MEMHEAP_AS_HEAP is not set | ||
# CONFIG_RT_USING_SLAB_AS_HEAP is not set | ||
# CONFIG_RT_USING_USERHEAP is not set | ||
# CONFIG_RT_USING_NOHEAP is not set | ||
# CONFIG_RT_USING_MEMTRACE is not set | ||
# CONFIG_RT_USING_HEAP_ISR is not set | ||
CONFIG_RT_USING_HEAP=y | ||
# end of Memory Management | ||
|
||
# CONFIG_RT_USING_INTERRUPT_INFO is not set | ||
# CONFIG_RT_USING_THREADSAFE_PRINTF is not set | ||
# CONFIG_RT_USING_SCHED_THREAD_CTX is not set | ||
CONFIG_RT_USING_CONSOLE=y | ||
CONFIG_RT_CONSOLEBUF_SIZE=128 | ||
CONFIG_RT_CONSOLE_DEVICE_NAME="" | ||
CONFIG_RT_VER_NUM=0x50200 | ||
# CONFIG_RT_USING_STDC_ATOMIC is not set | ||
CONFIG_RT_BACKTRACE_LEVEL_MAX_NR=32 | ||
# end of RT-Thread Kernel | ||
|
||
# | ||
# RT-Thread Components | ||
# | ||
CONFIG_RT_USING_COMPONENTS_INIT=y | ||
CONFIG_RT_USING_USER_MAIN=y | ||
CONFIG_RT_MAIN_THREAD_STACK_SIZE=2048 | ||
CONFIG_RT_MAIN_THREAD_PRIORITY=10 | ||
# CONFIG_RT_USING_LEGACY is not set | ||
CONFIG_RT_USING_MSH=y | ||
CONFIG_RT_USING_FINSH=y | ||
CONFIG_FINSH_USING_MSH=y | ||
CONFIG_FINSH_THREAD_NAME="tshell" | ||
CONFIG_FINSH_THREAD_PRIORITY=20 | ||
CONFIG_FINSH_THREAD_STACK_SIZE=4096 | ||
CONFIG_FINSH_USING_HISTORY=y | ||
CONFIG_FINSH_HISTORY_LINES=5 | ||
CONFIG_FINSH_USING_SYMTAB=y | ||
CONFIG_FINSH_CMD_SIZE=80 | ||
CONFIG_MSH_USING_BUILT_IN_COMMANDS=y | ||
CONFIG_FINSH_USING_DESCRIPTION=y | ||
# CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set | ||
# CONFIG_FINSH_USING_AUTH is not set | ||
CONFIG_FINSH_ARG_MAX=10 | ||
CONFIG_FINSH_USING_OPTION_COMPLETION=y | ||
|
||
# | ||
# Using USB legacy version | ||
# | ||
# CONFIG_RT_USING_USB_HOST is not set | ||
# CONFIG_RT_USING_USB_DEVICE is not set | ||
# end of Using USB legacy version | ||
|
||
# CONFIG_RT_USING_FDT is not set | ||
# end of RT-Thread Components | ||
|
||
# | ||
# RT-Thread Utestcases | ||
# | ||
# CONFIG_RT_USING_UTESTCASES is not set | ||
# end of RT-Thread Utestcases | ||
|
||
# | ||
# Hardware Drivers Config | ||
# | ||
CONFIG_CPU_S32K344=y | ||
# end of Hardware Drivers Config |
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,13 @@ | ||
mainmenu "RT-Thread Configuration" | ||
|
||
BSP_DIR := . | ||
|
||
RTT_DIR := ../../.. | ||
|
||
PKGS_DIR := packages | ||
|
||
source "$(RTT_DIR)/Kconfig" | ||
osource "$PKGS_DIR/Kconfig" | ||
rsource "libraries/Kconfig" | ||
rsource "board/Kconfig" | ||
|
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,15 @@ | ||
# for module compiling | ||
import os | ||
Import('RTT_ROOT') | ||
from building import * | ||
|
||
cwd = GetCurrentDir() | ||
objs = [] | ||
list = os.listdir(cwd) | ||
|
||
for d in list: | ||
path = os.path.join(cwd, d) | ||
if os.path.isfile(os.path.join(path, 'SConscript')): | ||
objs = objs + SConscript(os.path.join(d, 'SConscript')) | ||
|
||
Return('objs') |
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,57 @@ | ||
import os | ||
import sys | ||
import rtconfig | ||
|
||
if os.getenv('RTT_ROOT'): | ||
RTT_ROOT = os.getenv('RTT_ROOT') | ||
else: | ||
RTT_ROOT = os.path.normpath(os.getcwd() + '/../../../..') | ||
|
||
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')] | ||
try: | ||
from building import * | ||
except: | ||
print('Cannot found RT-Thread root directory, please check RTT_ROOT') | ||
print(RTT_ROOT) | ||
exit(-1) | ||
|
||
TARGET = 'rtthread.' + rtconfig.TARGET_EXT | ||
|
||
DefaultEnvironment(tools=[]) | ||
env = Environment(tools = ['mingw'], | ||
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS, | ||
CC = rtconfig.CC, CFLAGS = rtconfig.CFLAGS, | ||
AR = rtconfig.AR, ARFLAGS = '-rc', | ||
CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS, | ||
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS) | ||
env.PrependENVPath('PATH', rtconfig.EXEC_PATH) | ||
|
||
if rtconfig.PLATFORM in ['iccarm']: | ||
env.Replace(CCCOM = ['$CC $CFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES']) | ||
env.Replace(ARFLAGS = ['']) | ||
env.Replace(LINKCOM = env["LINKCOM"] + ' --map rtthread.map') | ||
|
||
Export('RTT_ROOT') | ||
Export('rtconfig') | ||
|
||
SDK_ROOT = os.path.abspath('./') | ||
|
||
if os.path.exists(SDK_ROOT + '/libraries'): | ||
libraries_path_prefix = SDK_ROOT + '/libraries' | ||
else: | ||
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries' | ||
|
||
SDK_LIB = libraries_path_prefix | ||
Export('SDK_LIB') | ||
|
||
# prepare building environment | ||
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False) | ||
|
||
S32K3_library = 'RTD' | ||
rtconfig.BSP_LIBRARY_TYPE = S32K3_library | ||
|
||
# include libraries | ||
objs.extend(SConscript(os.path.join(libraries_path_prefix, S32K3_library, 'SConscript'))) | ||
|
||
# make a building | ||
DoBuilding(TARGET, objs) |
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,11 @@ | ||
Import('RTT_ROOT') | ||
Import('rtconfig') | ||
from building import * | ||
|
||
cwd = GetCurrentDir() | ||
src = Glob('*.c') | ||
CPPPATH = [cwd] | ||
|
||
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH) | ||
|
||
Return('group') |
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,31 @@ | ||
/* | ||
* Copyright (c) 2006-2024, RT-Thread Development Team | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* Change Logs: | ||
* Date Author Notes | ||
* 2024-10-16 Pillar first version | ||
*/ | ||
|
||
#include <rtthread.h> | ||
#include <board.h> | ||
|
||
void led_thread(void *parameter) | ||
{ | ||
while (1) | ||
{ | ||
Dio_WriteChannel(DioConf_DioChannel_LED, STD_HIGH); | ||
rt_thread_mdelay(500); | ||
Dio_WriteChannel(DioConf_DioChannel_LED, STD_LOW); | ||
rt_thread_mdelay(500); | ||
} | ||
} | ||
|
||
int main(void) | ||
{ | ||
rt_thread_t tid; | ||
tid = rt_thread_create("led", led_thread, RT_NULL, 512, 5, 10); | ||
if (tid != RT_NULL) | ||
rt_thread_startup(tid); | ||
} |
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,9 @@ | ||
menu "Hardware Drivers Config" | ||
|
||
config CPU_S32K344 | ||
bool | ||
select RT_USING_COMPONENTS_INIT | ||
select RT_USING_USER_MAIN | ||
default y | ||
|
||
endmenu |
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,29 @@ | ||
import os | ||
import rtconfig | ||
from building import * | ||
|
||
Import('SDK_LIB') | ||
|
||
cwd = GetCurrentDir() | ||
chip_lib_path = SDK_LIB + '/s32k344' | ||
|
||
# add general drivers | ||
src = Split(''' | ||
board.c | ||
Siul2_Port_Ip_Cfg.c | ||
Tspc_Port_Ip_Cfg.c | ||
''') | ||
src += Glob(chip_lib_path + '/generate/src/*.c') | ||
|
||
path = [cwd] | ||
path += [chip_lib_path + '/generate/include'] | ||
path += [chip_lib_path + '/Startup_Code/include'] | ||
|
||
startup_path_prefix = chip_lib_path + '/Startup_Code/src' | ||
if rtconfig.PLATFORM in ['gcc']: | ||
src += Glob(startup_path_prefix + '/*.c') | ||
src += Glob(startup_path_prefix + '/*.s') | ||
|
||
CPPDEFINES = ['I_CACHE_ENABLE', 'D_CACHE_ENABLE', 'ENABLE_FPU', 'MPU_ENABLE'] | ||
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES) | ||
Return('group') |
Oops, something went wrong.