Add different cortex m0/m3/m4 build directories

This commit is contained in:
Dmitry 2022-01-14 16:13:46 +03:00
parent 6d44b0257e
commit ada55a8693
19 changed files with 580 additions and 26 deletions

View File

@ -0,0 +1,38 @@
#
# Makefile for FX-RTOS library.
# Use 'make src' to perform dependency injection and to copy kernel files from
# FX-RTOS sources root location provided by environment variable FXRTOS_DIR.
# Use 'make' or 'make lib' to create library containing the kernel.
#
GCC_PREFIX ?= arm-none-eabi-
CC=$(GCC_PREFIX)gcc
C_SRCS = $(wildcard src/*.c)
ASM_SRCS = $(wildcard src/*.S)
OBJS = $(C_SRCS:.c=.o) $(ASM_SRCS:.S=.o)
CFLAGS=-pedantic -std=c99 -O2 -Wall -ffunction-sections -mcpu=cortex-m0 -mthumb -Isrc -ffreestanding -include includes.inc
ASFLAGS=-include includes.inc -mcpu=cortex-m0 -Isrc
MAP_FILE ?= lite.map
lib: $(OBJS)
$(GCC_PREFIX)ar rcs libfxrtos.a $(OBJS)
echo '#define FX_INTERFACE(hdr) <stddef.h>' > FXRTOS.h
echo '#define FX_METADATA(data)' >> FXRTOS.h
for header in $(addsuffix .h, $(shell cat src/fxrtos.lst)); do cat src/$$header >> FXRTOS.h; done
src:
@[ "${FXDJ}" ] || (echo "FXDJ is not set" ; exit 1)
@[ "${FXRTOS_DIR}" ] || (echo "FXRTOS_DIR is not set" ; exit 1)
@echo Performing dependency injection: sources root = $(FXRTOS_DIR)
mkdir src
export FX_PREP="$(GCC_PREFIX)gcc -E -Isrc -ffreestanding -include %s %s"; \
$(realpath $(FXDJ)) -p .,$(FXRTOS_DIR)/components -a $(MAP_FILE) -t FXRTOS -o src -l src/fxrtos.lst || (rmdir src; exit 1)
echo '#define FX_INTERFACE(hdr) <hdr.h>' > src/includes.inc
echo '#define FX_METADATA(data)' >> src/includes.inc
.PHONY: clean
clean:
rm -f $(OBJS) *.tmp FXRTOS.h libfxrtos.a

View File

@ -0,0 +1,80 @@
rem Windows build script for FX-RTOS kernel.
rem By default it uses GNU toolchain. To select another one use TOOLCHAIN env
rem variable: set it to ARM or IAR to use ARM Keil MDK or IAR EWARM respectively.
@echo off
echo Cleaning up...
if exist src\*.o del /F /Q src\*.o
if exist *fxrtos.* del /F /Q *fxrtos.*
if exist *.tmp del /F /Q *.tmp
if "%1"=="clean" (
echo OK
exit /b 0
)
if "%MAP_FILE%"=="" (
if exist default.map (
set MAP_FILE=default.map
) else (
set MAP_FILE=lite.map
)
)
if "%TOOLCHAIN%"=="IAR" (
set FX_PREP=pr.bat %%s %%s
set CC=iccarm --cpu Cortex-M0 -e --fpu None --endian=little --preinclude includes.inc -I. -o
set AS=iasmarm -s+ -r --cpu Cortex-M0 --fpu None -I. -o
set AR=iarchive --create ../libfxrtos.a
) else (
if "%TOOLCHAIN%"=="ARM" (
set FX_PREP=armcc -I src -E --preinclude %%s %%s
set CC=armcc --cpu Cortex-M0 --c99 --preinclude ./includes.inc -I. -c -o
set AS=armasm --cpu Cortex-M0 --cpreproc --cpreproc_opts=--preinclude,includes.inc -I. -o
set AR=armar -r ../fxrtos.lib
) else (
set FX_PREP=%GCC_PREFIX%gcc -E -Isrc -include %%s %%s
set CC=%GCC_PREFIX%gcc -mcpu=cortex-m0 -mthumb -pedantic -std=c99 -O2 -include includes.inc -I. -c -ffunction-sections -fpack-struct=8 -o
set AS=%GCC_PREFIX%gcc -mcpu=cortex-m0 -mthumb -include includes.inc -I. -c -o
set AR=%GCC_PREFIX%ar rcs ../libfxrtos.a
)
)
if not exist src (
mkdir src
echo Performing dependency injection...
%FXDJ% -p .,%FXRTOS_DIR%\components -t FXRTOS -a %MAP_FILE% -o src -l src\fxrtos.lst
echo #define FX_METADATA^(data^) > src/includes.inc
echo #define FX_INTERFACE^(hdr^) ^<hdr.h^> >> src/includes.inc
)
if "%1" == "srccopy" (
echo OK
exit /b 0
)
call set OBJS=
cd src
echo Compiling...
for %%f in (*.c) do (
echo %%f
%CC% %%~nf.o %%f
call set OBJS=%%OBJS%% %%~nf.o
)
for %%f in (*.S) do (
echo %%f
%AS% %%~nf.o %%f
call set OBJS=%%OBJS%% %%~nf.o
)
echo Creating library...
%AR% %OBJS%
cd ..
echo Creating common header...
echo #define FX_METADATA^(data^) > FXRTOS.h
echo #define FX_INTERFACE^(file^) ^<stdint.h^> >> FXRTOS.h
for /F "tokens=*" %%A in (src\fxrtos.lst) do type src\%%A.h >> FXRTOS.h

View File

@ -0,0 +1,30 @@
LANG_ASM = ARMv7M
HW_CPU = ARMv6M_V1
HAL_BARRIER = UP
HAL_CPU_CONTEXT = KER_FRAME_BASED
HAL_MP = STUB_V1
HAL_INIT = ARMv7M_LIB
HAL_CPU_INTR = ARMv6M_V1
HAL_CLOCK = ARMv7M_V1
HAL_INTR_FRAME = ARMv6M_V1
HAL_ASYNC = ARMv7M_UNIFIED
FX_SPL = UNIFIED_UP
FX_DPC = STUB
FX_PROCESS = DISABLED
FX_PANIC = UP
FX_RTP = DISABLED
FX_SCHED = UP_FIFO
FX_SCHED_ALG = MPQ_FIFO
FX_SYNC = UP_QUEUE
FX_TIMER = DIRECT
FX_TIMER_INTERNAL = SIMPLE
FX_APP_TIMER = PROXY
FX_SYS_TIMER = PROXY
FX_THREAD_APC = LIMITED
FX_THREAD_TIMESLICE = ENABLED
FX_THREAD_CLEANUP = DISABLED
FX_STACKOVF = DISABLED
FX_MEM_POOL = TLSF
TRACE_CORE = STUB
TRACE_LOCKS = STUB

View File

@ -0,0 +1,4 @@
echo off
iccarm -I src --silent --preprocess=n temp.i --preinclude %1 %2
type temp.i
del temp.i

View File

@ -0,0 +1,46 @@
#ifndef _CFG_OPTIONS_STD_CM0_HEADER_
#define _CFG_OPTIONS_STD_CM0_HEADER_
/**
******************************************************************************
* @file standard-cortex-m0-options.h
* @brief Kernel options.
******************************************************************************
* Copyright (C) JSC EREMEX, 2008-2020.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#define FX_SCHED_ALG_PRIO_NUM 32
#define FX_TIMER_THREAD_PRIO 1
#define FX_TIMER_THREAD_STACK_SIZE 0x400
#define HAL_INIT_INTR_STACK_SIZE 0x400
#define RTL_MEM_POOL_MAX_CHUNK 15
#ifndef __IAR_SYSTEMS_ASM__
FX_METADATA(({ interface: [CFG_OPTIONS, STANDARD_CORTEX_M0] }))
#endif
#endif

View File

@ -0,0 +1,32 @@
/**
******************************************************************************
* @file standard-cortex-m0.c
* @brief Kernel dependencies root.
******************************************************************************
* Copyright (C) JSC EREMEX, 2008-2020.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#include FX_INTERFACE(FXRTOS)
FX_METADATA(({ implementation: [FXRTOS, STANDARD_CORTEX_M0] }))

View File

@ -0,0 +1,51 @@
#ifndef _FXRTOS_STANDARD_CM0_HEADER_
#define _FXRTOS_STANDARD_CM0_HEADER_
/**
******************************************************************************
* @file standard-cortex-m0.h
* @brief Kernel dependencies.
******************************************************************************
* Copyright (C) JSC EREMEX, 2008-2020.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#include FX_INTERFACE(HAL_INIT)
#include FX_INTERFACE(HAL_CPU_INTR)
#include FX_INTERFACE(FX_TIMER)
#include FX_INTERFACE(FX_THREAD)
#include FX_INTERFACE(FX_DPC)
#include FX_INTERFACE(FX_SEM)
#include FX_INTERFACE(FX_MUTEX)
#include FX_INTERFACE(FX_MSGQ)
#include FX_INTERFACE(FX_RWLOCK)
#include FX_INTERFACE(FX_BLOCK_POOL)
#include FX_INTERFACE(FX_EV_FLAGS)
#include FX_INTERFACE(FX_COND)
#include FX_INTERFACE(FX_MEM_POOL)
//----------------------------------------------------------------------------------------------------
FX_METADATA(({ interface: [FXRTOS, STANDARD_CORTEX_M0] }))
#endif

View File

@ -17,10 +17,6 @@ ASFLAGS=-include includes.inc -mcpu=cortex-m3 -Isrc
MAP_FILE ?= lite.map
all:
${MAKE} src
${MAKE} lib
lib: $(OBJS)
$(GCC_PREFIX)ar rcs libfxrtos.a $(OBJS)
echo '#define FX_INTERFACE(hdr) <stddef.h>' > FXRTOS.h
@ -40,4 +36,3 @@ src:
.PHONY: clean
clean:
rm -f $(OBJS) *.tmp FXRTOS.h libfxrtos.a

View File

@ -1,6 +1,6 @@
rem Windows build script for FX-RTOS kernel.
rem By default it uses GNU toolchain. To select another one use TOOLCHAIN env
rem variable: set it to KEIL or IAR to use Keil MDK or IAR EWARM respectively.
rem variable: set it to ARM or IAR to use ARM Keil MDK or IAR EWARM respectively.
@echo off
echo Cleaning up...
@ -15,29 +15,28 @@ if "%1"=="clean" (
)
if "%MAP_FILE%"=="" (
set MAP_FILE=default.map
if exist default.map (
set MAP_FILE=default.map
) else (
set MAP_FILE=lite.map
)
)
if "%TOOLCHAIN%"=="IAR" (
set FX_PREP=pr.bat %%s %%s
set CC=iccarm --cpu=Cortex-M3 -e --fpu=None --endian=little --preinclude includes.inc -I. -o
set CC=iccarm --cpu Cortex-M3 --fpu None -e --endian=little --preinclude includes.inc -I. -o
set AS=iasmarm -s+ -r --cpu Cortex-M3 --fpu None -I. -o
set AR=iarchive --create ../libfxrtos.a
) else (
if "%TOOLCHAIN%"=="KEIL" (
if "%TOOLCHAIN%"=="ARM" (
set FX_PREP=armcc -I src -E --preinclude %%s %%s
set CC=armcc --cpu Cortex-M3 --c99 --preinclude ./includes.inc -I. -c -o
set AS=armasm --cpu Cortex-M3 --cpreproc --cpreproc_opts=--preinclude,includes.inc -I. -o
set AR=armar -r ../fxrtos.lib
) else (
if "%MAP_FILE%"=="m4f.map" (
set CPU_OPTS=-mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard
) else (
set CPU_OPTS=-mcpu=cortex-m3
)
set FX_PREP=%GCC_PREFIX%gcc -E -Isrc -include %%s %%s
set CC=%GCC_PREFIX%gcc -pedantic -std=c99 -O2 -Wall -ffunction-sections -include includes.inc %CPU_OPTS% -mthumb -I. -c -o
set AS=%GCC_PREFIX%gcc %CPU_OPTS% -mthumb -I. -include includes.inc -c -o
set CC=%GCC_PREFIX%gcc -mcpu=cortex-m3 -mthumb -pedantic -std=c99 -O2 -Wall -ffunction-sections -include includes.inc -I. -c -o
set AS=%GCC_PREFIX%gcc -mcpu=cortex-m3 -mthumb -I. -include includes.inc -c -o
set AR=%GCC_PREFIX%ar rcs ../libfxrtos.a
)
)
@ -74,7 +73,8 @@ for %%f in (*.S) do (
echo Creating library...
%AR% %OBJS%
cd ..
echo Creating common header...
echo #define FX_METADATA^(data^) > FXRTOS.h
echo #define FX_INTERFACE^(file^) ^<stdint.h^> >> FXRTOS.h
for /F "tokens=*" %%A in (src\fxrtos.lst) do type src\%%A.h >> FXRTOS.h
for /F "tokens=*" %%A in (src\fxrtos.lst) do type src\%%A.h >> FXRTOS.h

View File

@ -1,5 +1,5 @@
#ifndef _CFG_OPTIONS_STD_CM3_GNU_HEADER_
#define _CFG_OPTIONS_STD_CM3_GNU_HEADER_
#ifndef _CFG_OPTIONS_STD_CM3_HEADER_
#define _CFG_OPTIONS_STD_CM3_HEADER_
/**
******************************************************************************
@ -35,9 +35,10 @@
#define FX_TIMER_THREAD_STACK_SIZE 0x400
#define HAL_INIT_INTR_STACK_SIZE 0x400
#define RTL_MEM_POOL_MAX_CHUNK 15
#define HW_PIT_TICK_PERIOD 100000
#ifndef __IAR_SYSTEMS_ASM__
FX_METADATA(({ interface: [CFG_OPTIONS, STANDARD_CORTEX_M3_GNU] }))
FX_METADATA(({ interface: [CFG_OPTIONS, STANDARD_CORTEX_M3] }))
#endif
#endif

View File

@ -29,5 +29,4 @@
#include FX_INTERFACE(FXRTOS)
FX_METADATA(({ implementation: [FXRTOS, STANDARD_CORTEX_M3_GNU] }))
FX_METADATA(({ implementation: [FXRTOS, STANDARD_CORTEX_M3] }))

View File

@ -1,9 +1,9 @@
#ifndef _FXRTOS_STANDARD_CM3_GNU_HEADER_
#define _FXRTOS_STANDARD_CM3_GNU_HEADER_
#ifndef _FXRTOS_STANDARD_CM3_HEADER_
#define _FXRTOS_STANDARD_CM3_HEADER_
/**
******************************************************************************
* @file standard-cortex-m3-options.h
* @file standard-cortex-m3.h
* @brief Kernel dependencies.
******************************************************************************
* Copyright (C) JSC EREMEX, 2008-2020.
@ -44,7 +44,7 @@
#include FX_INTERFACE(FX_COND)
#include FX_INTERFACE(FX_MEM_POOL)
FX_METADATA(({ interface: [FXRTOS, STANDARD_CORTEX_M3_GNU] }))
FX_METADATA(({ interface: [FXRTOS, STANDARD_CORTEX_M3] }))
#endif

View File

@ -0,0 +1,38 @@
#
# Makefile for FX-RTOS library.
# Use 'make src' to perform dependency injection and to copy kernel files from
# FX-RTOS sources root location provided by environment variable FXRTOS_DIR.
# Use 'make' or 'make lib' to create library containing the kernel.
#
GCC_PREFIX ?= arm-none-eabi-
CC=$(GCC_PREFIX)gcc
C_SRCS = $(wildcard src/*.c)
ASM_SRCS = $(wildcard src/*.S)
OBJS = $(C_SRCS:.c=.o) $(ASM_SRCS:.S=.o)
CFLAGS=-pedantic -std=c99 -O2 -Wall -ffunction-sections -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mthumb -Isrc -ffreestanding -include includes.inc
ASFLAGS=-include includes.inc -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -Isrc
MAP_FILE ?= lite.map
lib: $(OBJS)
$(GCC_PREFIX)ar rcs libfxrtos.a $(OBJS)
echo '#define FX_INTERFACE(hdr) <stddef.h>' > FXRTOS.h
echo '#define FX_METADATA(data)' >> FXRTOS.h
for header in $(addsuffix .h, $(shell cat src/fxrtos.lst)); do cat src/$$header >> FXRTOS.h; done
src:
@[ "${FXDJ}" ] || (echo "FXDJ is not set" ; exit 1)
@[ "${FXRTOS_DIR}" ] || (echo "FXRTOS_DIR is not set" ; exit 1)
@echo Performing dependency injection: sources root = $(FXRTOS_DIR)
mkdir src
export FX_PREP="$(GCC_PREFIX)gcc -E -Isrc -ffreestanding -include %s %s"; \
$(realpath $(FXDJ)) -p .,$(FXRTOS_DIR)/components -a $(MAP_FILE) -t FXRTOS -o src -l src/fxrtos.lst || (rmdir src; exit 1)
echo '#define FX_INTERFACE(hdr) <hdr.h>' > src/includes.inc
echo '#define FX_METADATA(data)' >> src/includes.inc
.PHONY: clean
clean:
rm -f $(OBJS) *.tmp FXRTOS.h libfxrtos.a

View File

@ -0,0 +1,80 @@
rem Windows build script for FX-RTOS kernel.
rem By default it uses GNU toolchain. To select another one use TOOLCHAIN env
rem variable: set it to ARM or IAR to use ARM Keil MDK or IAR EWARM respectively.
@echo off
echo Cleaning up...
if exist src\*.o del /F /Q src\*.o
if exist *fxrtos.* del /F /Q *fxrtos.*
if exist *.tmp del /F /Q *.tmp
if "%1"=="clean" (
echo OK
exit /b 0
)
if "%MAP_FILE%"=="" (
if exist default.map (
set MAP_FILE=default.map
) else (
set MAP_FILE=lite.map
)
)
if "%TOOLCHAIN%"=="IAR" (
set FX_PREP=pr.bat %%s %%s
set CC=iccarm --cpu Cortex-M4 --fpu VFPv4_sp -e --endian=little --preinclude includes.inc -I. -o
set AS=iasmarm -s+ -r --cpu Cortex-M4 --fpu VFPv4_sp -I. -o
set AR=iarchive --create ../libfxrtos.a
) else (
if "%TOOLCHAIN%"=="ARM" (
set FX_PREP=armcc -I src -E --preinclude %%s %%s
set CC=armcc --cpu Cortex-M4 --fpu=fpv4-sp --c99 --preinclude ./includes.inc -I. -c -o
set AS=armasm --cpu Cortex-M4 --fpu=fpv4-sp --cpreproc --cpreproc_opts=--preinclude,includes.inc -I. -o
set AR=armar -r ../fxrtos.lib
) else (
set FX_PREP=%GCC_PREFIX%gcc -E -Isrc -include %%s %%s
set CC=%GCC_PREFIX%gcc -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -pedantic -std=c99 -O2 -include includes.inc -I. -Wall -ffunction-sections -c -o
set AS=%GCC_PREFIX%gcc -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -I. -include includes.inc -c -o
set AR=%GCC_PREFIX%ar rcs ../libfxrtos.a
)
)
if not exist src (
mkdir src
echo Performing dependency injection...
%FXDJ% -p .,%FXRTOS_DIR%\components -t FXRTOS -a %MAP_FILE% -o src -l src\fxrtos.lst
echo #define FX_METADATA^(data^) > src/includes.inc
echo #define FX_INTERFACE^(hdr^) ^<hdr.h^> >> src/includes.inc
)
if "%1" == "srccopy" (
echo OK
exit /b 0
)
call set OBJS=
cd src
echo Compiling...
for %%f in (*.c) do (
echo Compiling %%f...
%CC% %%~nf.o %%f
call set OBJS=%%OBJS%% %%~nf.o
)
for %%f in (*.S) do (
echo Assembling %%f...
%AS% %%~nf.o %%f
call set OBJS=%%OBJS%% %%~nf.o
)
echo Creating library...
%AR% %OBJS%
cd ..
echo Creating common header...
echo #define FX_METADATA^(data^) > FXRTOS.h
echo #define FX_INTERFACE^(file^) ^<stdint.h^> >> FXRTOS.h
for /F "tokens=*" %%A in (src\fxrtos.lst) do type src\%%A.h >> FXRTOS.h

View File

@ -0,0 +1,30 @@
LANG_ASM = ARMv7M
HW_CPU = ARMv7M_V1
HAL_BARRIER = UP
HAL_CPU_CONTEXT = KER_FRAME_BASED
HAL_MP = STUB_V1
HAL_INIT = ARMv7M_LIB
HAL_CPU_INTR = ARMv7M_FPU
HAL_CLOCK = ARMv7M_V1
HAL_INTR_FRAME = ARMv7M_FPU
HAL_ASYNC = ARMv7M_UNIFIED
FX_SPL = UNIFIED_UP
FX_DPC = STUB
FX_PROCESS = DISABLED
FX_PANIC = UP
FX_RTP = DISABLED
FX_SCHED = UP_FIFO
FX_SCHED_ALG = MPQ_FIFO
FX_SYNC = UP_QUEUE
FX_TIMER = DIRECT
FX_TIMER_INTERNAL = SIMPLE
FX_APP_TIMER = PROXY
FX_SYS_TIMER = PROXY
FX_THREAD_APC = LIMITED
FX_THREAD_TIMESLICE = ENABLED
FX_THREAD_CLEANUP = DISABLED
FX_STACKOVF = DISABLED
FX_MEM_POOL = TLSF
TRACE_CORE = STUB
TRACE_LOCKS = STUB

View File

@ -0,0 +1,4 @@
echo off
iccarm -I src --silent --preprocess=n temp.i --preinclude %1 %2
type temp.i
del temp.i

View File

@ -0,0 +1,44 @@
#ifndef _CFG_OPTIONS_STD_CM4_HEADER_
#define _CFG_OPTIONS_STD_CM4_HEADER_
/**
******************************************************************************
* @file standard-cortex-m4-options.h
* @brief Kernel options.
******************************************************************************
* Copyright (C) JSC EREMEX, 2008-2020.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#define FX_SCHED_ALG_PRIO_NUM 32
#define FX_TIMER_THREAD_PRIO 1
#define FX_TIMER_THREAD_STACK_SIZE 0x400
#define HAL_INIT_INTR_STACK_SIZE 0x400
#define RTL_MEM_POOL_MAX_CHUNK 15
#define HW_PIT_TICK_PERIOD 100000
#ifndef __IAR_SYSTEMS_ASM__
FX_METADATA(({ interface: [CFG_OPTIONS, STANDARD_CORTEX_M4] }))
#endif
#endif

View File

@ -0,0 +1,33 @@
/**
******************************************************************************
* @file standard-cortex-m4.c
* @brief Kernel dependencies root.
******************************************************************************
* Copyright (C) JSC EREMEX, 2008-2020.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#include FX_INTERFACE(FXRTOS)
FX_METADATA(({ implementation: [FXRTOS, STANDARD_CORTEX_M4] }))

View File

@ -0,0 +1,49 @@
#ifndef _FXRTOS_STANDARD_CM4_HEADER_
#define _FXRTOS_STANDARD_CM4_HEADER_
/**
******************************************************************************
* @file standard-cortex-m4.h
* @brief Kernel dependencies.
******************************************************************************
* Copyright (C) JSC EREMEX, 2008-2020.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
#include FX_INTERFACE(HAL_INIT)
#include FX_INTERFACE(HAL_CPU_INTR)
#include FX_INTERFACE(FX_TIMER)
#include FX_INTERFACE(FX_THREAD)
#include FX_INTERFACE(FX_DPC)
#include FX_INTERFACE(FX_SEM)
#include FX_INTERFACE(FX_MUTEX)
#include FX_INTERFACE(FX_MSGQ)
#include FX_INTERFACE(FX_BLOCK_POOL)
#include FX_INTERFACE(FX_EV_FLAGS)
#include FX_INTERFACE(FX_RWLOCK)
#include FX_INTERFACE(FX_COND)
#include FX_INTERFACE(FX_MEM_POOL)
FX_METADATA(({ interface: [FXRTOS, STANDARD_CORTEX_M4] }))
#endif