From 670ca8faca2788396697baf93893c9bafb812269 Mon Sep 17 00:00:00 2001 From: wxd <15576600345@qq.com> Date: Wed, 15 Dec 2021 10:46:09 +0800 Subject: [PATCH 01/14] standalone sdk version --- install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.py b/install.py index 1beee322..e03dcebe 100644 --- a/install.py +++ b/install.py @@ -86,7 +86,7 @@ os.system("chmod +x ./make/*.mk --silent ") os.system("chmod +x ./lib/Kconfiglib/*.py --silent ") # Add standalone sdk -standalone_sdk_v="v0.1.8" +standalone_sdk_v="v0.1.15" standalone_path=freertos_sdk_path + '/standalone' standalone_branche="master" standalone_remote="https://gitee.com/phytium_embedded/phytium-standalone-sdk.git" -- Gitee From 2413acd233922b17d1028b284f4438ae6fdd92f1 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 15 Dec 2021 18:16:52 +0800 Subject: [PATCH 02/14] =?UTF-8?q?=E6=9F=A5=E6=89=BEaarch64=20=E5=90=AF?= =?UTF-8?q?=E5=8A=A8=E5=BC=82=E5=B8=B8=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 6 +- .vscode/settings.json | 3 +- example/function_test/main.c | 5 +- example/function_test/sdkconfig | 47 +- example/function_test/sdkconfig.h | 46 +- example/function_test/src/test_uart.c | 16 +- example/function_test/src/test_uart.c_o | 33 ++ install.py | 2 +- make/complier.mk | 4 +- make/ld/Kconfig | 85 +-- make/ld/aarch32_ram.ld | 161 +++-- make/ld/aarch64_ram.ld | 214 ++++--- make/ld_o/Kconfig | 105 ++++ make/ld_o/aarch32_ram.ld | 147 +++++ make/ld_o/aarch64_ram.ld | 127 ++++ standalone | 1 + standalone_adaptive.mk | 10 + standalone_o | 1 + .../GCC/ft_platform/aarch32/FreeRTOSConfig.h | 4 +- .../portable/GCC/ft_platform/aarch32/vector.S | 80 +++ .../GCC/ft_platform/aarch64/FreeRTOSConfig.h | 4 + .../portable/GCC/ft_platform/aarch64/port.c | 1 - .../GCC/ft_platform/aarch64/portASM.S | 4 +- .../GCC/ft_platform/aarch64/portAsm_debug.c | 22 + .../GCC/ft_platform/aarch64/vectors.S | 260 ++++++++ .../GCC/ft_platform/aarch64/vectors_g.c | 25 + .../ft_platform_o/aarch32/FreeRTOSConfig.h | 250 ++++++++ .../portable/GCC/ft_platform_o/aarch32/port.c | 554 ++++++++++++++++++ .../GCC/ft_platform_o/aarch32/portASM.S | 339 +++++++++++ .../GCC/ft_platform_o/aarch32/portmacro.h | 201 +++++++ .../ft_platform_o/aarch64/FreeRTOSConfig.h | 191 ++++++ .../portable/GCC/ft_platform_o/aarch64/port.c | 514 ++++++++++++++++ .../GCC/ft_platform_o/aarch64/portASM.S | 433 ++++++++++++++ .../GCC/ft_platform_o/aarch64/portmacro.h | 211 +++++++ .../freertos/portable/freertos_configs.c | 15 +- .../freertos/portable/freertos_configs.c_o | 194 ++++++ third-party/freertos/tasks.c | 1 - third-party/freertos/timers.c | 2 +- 38 files changed, 4050 insertions(+), 268 deletions(-) create mode 100644 example/function_test/src/test_uart.c_o create mode 100644 make/ld_o/Kconfig create mode 100644 make/ld_o/aarch32_ram.ld create mode 100644 make/ld_o/aarch64_ram.ld create mode 160000 standalone create mode 100644 standalone_adaptive.mk create mode 160000 standalone_o create mode 100644 third-party/freertos/portable/GCC/ft_platform/aarch32/vector.S create mode 100644 third-party/freertos/portable/GCC/ft_platform/aarch64/portAsm_debug.c create mode 100644 third-party/freertos/portable/GCC/ft_platform/aarch64/vectors.S create mode 100644 third-party/freertos/portable/GCC/ft_platform/aarch64/vectors_g.c create mode 100644 third-party/freertos/portable/GCC/ft_platform_o/aarch32/FreeRTOSConfig.h create mode 100644 third-party/freertos/portable/GCC/ft_platform_o/aarch32/port.c create mode 100644 third-party/freertos/portable/GCC/ft_platform_o/aarch32/portASM.S create mode 100644 third-party/freertos/portable/GCC/ft_platform_o/aarch32/portmacro.h create mode 100644 third-party/freertos/portable/GCC/ft_platform_o/aarch64/FreeRTOSConfig.h create mode 100644 third-party/freertos/portable/GCC/ft_platform_o/aarch64/port.c create mode 100644 third-party/freertos/portable/GCC/ft_platform_o/aarch64/portASM.S create mode 100644 third-party/freertos/portable/GCC/ft_platform_o/aarch64/portmacro.h create mode 100644 third-party/freertos/portable/freertos_configs.c_o diff --git a/.gitignore b/.gitignore index 14abf374..8c7644b6 100644 --- a/.gitignore +++ b/.gitignore @@ -63,6 +63,6 @@ dkms.conf /tools/gdb-* # Standalone sdk -standalone -sdk -phytium-standalone-sdk \ No newline at end of file +#standalone +#sdk +#phytium-standalone-sdk \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 51b12930..d67f2f7b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -41,6 +41,7 @@ "stdio.h": "c", "semphr.h": "c", "portmacro.h": "c", - "fwdt.h": "c" + "fwdt.h": "c", + "fpl011.h": "c" } } \ No newline at end of file diff --git a/example/function_test/main.c b/example/function_test/main.c index 82fe5292..d2bda41a 100644 --- a/example/function_test/main.c +++ b/example/function_test/main.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0. * * @Date: 2021-07-09 08:08:39 - * @LastEditTime: 2021-07-22 09:22:21 + * @LastEditTime: 2021-12-15 16:57:31 * @Description:  This files is for * * @Modify History: @@ -20,7 +20,7 @@ extern BaseType_t TestMsgQueueEntry(); int main() { BaseType_t xReturn = pdPASS; - + printf("main is start \r\n") ; xReturn = TestCpuStatsEntry(); if (pdPASS != xReturn) { @@ -33,6 +33,7 @@ int main() goto FAIL_EXIT; } + printf("vTaskStartScheduler \r\n") ; vTaskStartScheduler(); /* 启动任务,开启调度 */ while (1); /* 正常不会执行到这里 */ diff --git a/example/function_test/sdkconfig b/example/function_test/sdkconfig index bf666aa6..b77e1fd4 100644 --- a/example/function_test/sdkconfig +++ b/example/function_test/sdkconfig @@ -3,8 +3,6 @@ # Project Configuration # CONFIG_TARGET_NAME="ft2004_freertos" -#CONFIG_LWIP_POLL_TEST=y -# CONFIG_LWIP_INTRRUPT_TEST is not set # end of Project Configuration # @@ -15,14 +13,13 @@ CONFIG_USE_FREERTOS=y # # Arch Configuration # -CONFIG_TARGET_ARMV8_AARCH32=y -# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y # CONFIG_TARGET_ARMV7 is not set CONFIG_USE_CACHE=y CONFIG_USE_L3CACHE=y CONFIG_USE_MMU=y CONFIG_USE_SYS_TICK=y -CONFIG_USE_AARCH64_L1_TO_AARCH32=y # end of Arch Configuration # @@ -39,7 +36,7 @@ CONFIG_TARGET_F2000_4=y # CONFIG_USE_SPI is not set # CONFIG_USE_QSPI is not set CONFIG_USE_GIC=y -CONFIG_EBABLE_GICV3=y +CONFIG_ENABLE_GICV3=y CONFIG_USE_SERIAL=y # @@ -55,15 +52,8 @@ CONFIG_USE_ETH=y # # Eth Configuration # -# CONFIG_ENABLE_F_XMAC is not set -CONFIG_ENABLE_F_GMAC=y - -# -# F_GMAC Configuration -# -# CONFIG_F_GMAC_PHY_COMMON is not set -CONFIG_F_GMAC_PHY_AR803X=y -# end of F_GMAC Configuration +# CONFIG_ENABLE_FXMAC is not set +# CONFIG_ENABLE_FGMAC is not set # end of Eth Configuration # CONFIG_USE_CAN is not set @@ -73,20 +63,23 @@ CONFIG_F_GMAC_PHY_AR803X=y # CONFIG_USE_PCIE is not set # CONFIG_USE_WDT is not set # CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set # end of Components Configuration -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set # end of Standalone Setting # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y # # Cross-Compiler Setting # CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 # CONFIG_USE_EXT_COMPILER is not set # end of Cross-Compiler Setting @@ -98,10 +91,10 @@ CONFIG_LOG_INFO=y # CONFIG_LOG_NONE is not set # -# GNU Linker Setting +# Linker Options # -CONFIG_AARCH32_RAM_LD=y -# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y # CONFIG_USER_DEFINED_LD is not set CONFIG_LINK_SCRIPT_ROM=y CONFIG_ROM_START_UP_ADDR=0x80100000 @@ -109,9 +102,9 @@ CONFIG_ROM_SIZE_MB=1 CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 -CONFIG_HEAP_SIZE=0x100000 -CONFIG_STACK_SIZE=0x100000 -# end of GNU Linker Setting +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x40000 +# end of Linker Options # end of Building Option # @@ -128,11 +121,5 @@ CONFIG_FREERTOS_USE_UART=y # # FreeRTOS Setting # -#CONFIG_USE_LWIP=y - -# -# LWIP Configuration -# -#CONFIG_LWIP_F_GMAC=y -# end of LWIP Configuration +# CONFIG_USE_LWIP is not set # end of FreeRTOS Setting diff --git a/example/function_test/sdkconfig.h b/example/function_test/sdkconfig.h index 179f0cae..be7ab79d 100644 --- a/example/function_test/sdkconfig.h +++ b/example/function_test/sdkconfig.h @@ -4,8 +4,6 @@ /* Project Configuration */ #define CONFIG_TARGET_NAME "ft2004_freertos" -/*CONFIG_LWIP_POLL_TEST=y */ -/* CONFIG_LWIP_INTRRUPT_TEST is not set */ /* end of Project Configuration */ /* Standalone Setting */ @@ -14,14 +12,13 @@ /* Arch Configuration */ -#define CONFIG_TARGET_ARMV8_AARCH32 -/* CONFIG_TARGET_ARMV8_AARCH64 is not set */ +/* CONFIG_TARGET_ARMV8_AARCH32 is not set */ +#define CONFIG_TARGET_ARMV8_AARCH64 /* CONFIG_TARGET_ARMV7 is not set */ #define CONFIG_USE_CACHE #define CONFIG_USE_L3CACHE #define CONFIG_USE_MMU #define CONFIG_USE_SYS_TICK -#define CONFIG_USE_AARCH64_L1_TO_AARCH32 /* end of Arch Configuration */ /* Board Configuration */ @@ -36,7 +33,7 @@ /* CONFIG_USE_SPI is not set */ /* CONFIG_USE_QSPI is not set */ #define CONFIG_USE_GIC -#define CONFIG_EBABLE_GICV3 +#define CONFIG_ENABLE_GICV3 #define CONFIG_USE_SERIAL /* Usart Configuration */ @@ -49,14 +46,8 @@ /* Eth Configuration */ -/* CONFIG_ENABLE_F_XMAC is not set */ -#define CONFIG_ENABLE_F_GMAC - -/* F_GMAC Configuration */ - -/* CONFIG_F_GMAC_PHY_COMMON is not set */ -#define CONFIG_F_GMAC_PHY_AR803X -/* end of F_GMAC Configuration */ +/* CONFIG_ENABLE_FXMAC is not set */ +/* CONFIG_ENABLE_FGMAC is not set */ /* end of Eth Configuration */ /* CONFIG_USE_CAN is not set */ /* CONFIG_USE_I2C is not set */ @@ -65,17 +56,19 @@ /* CONFIG_USE_PCIE is not set */ /* CONFIG_USE_WDT is not set */ /* CONFIG_USE_DMA is not set */ +/* CONFIG_USE_NAND is not set */ +/* CONFIG_USE_RTC is not set */ /* end of Components Configuration */ -#define CONFIG_USE_LIBC +#define CONFIG_USE_G_LIBC +/* CONFIG_USE_NEW_LIBC is not set */ /* end of Standalone Setting */ /* Building Option */ -#define CONFIG_ENVI_UBUNTU_20_04 - /* Cross-Compiler Setting */ #define CONFIG_COMPILER_NO_STD_STARUP +#define CONFIG_GCC_OPTIMIZE_LEVEL 0 /* CONFIG_USE_EXT_COMPILER is not set */ /* end of Cross-Compiler Setting */ /* CONFIG_LOG_VERBOS is not set */ @@ -85,10 +78,10 @@ /* CONFIG_LOG_ERROR is not set */ /* CONFIG_LOG_NONE is not set */ -/* GNU Linker Setting */ +/* Linker Options */ -#define CONFIG_AARCH32_RAM_LD -/* CONFIG_AARCH64_RAM_LD is not set */ +/* CONFIG_AARCH32_RAM_LD is not set */ +#define CONFIG_AARCH64_RAM_LD /* CONFIG_USER_DEFINED_LD is not set */ #define CONFIG_LINK_SCRIPT_ROM #define CONFIG_ROM_START_UP_ADDR 0x80100000 @@ -96,9 +89,9 @@ #define CONFIG_LINK_SCRIPT_RAM #define CONFIG_RAM_START_UP_ADDR 0x81000000 #define CONFIG_RAM_SIZE_MB 64 -#define CONFIG_HEAP_SIZE 0x100000 -#define CONFIG_STACK_SIZE 0x100000 -/* end of GNU Linker Setting */ +#define CONFIG_HEAP_SIZE 1 +#define CONFIG_STACK_SIZE 0x40000 +/* end of Linker Options */ /* end of Building Option */ /* Component Configuration */ @@ -111,12 +104,7 @@ /* FreeRTOS Setting */ -/*CONFIG_USE_LWIP=y */ - -/* LWIP Configuration */ - -/*CONFIG_LWIP_F_GMAC=y */ -/* end of LWIP Configuration */ +/* CONFIG_USE_LWIP is not set */ /* end of FreeRTOS Setting */ #endif diff --git a/example/function_test/src/test_uart.c b/example/function_test/src/test_uart.c index 5fd9715f..d1ab31d9 100644 --- a/example/function_test/src/test_uart.c +++ b/example/function_test/src/test_uart.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0. * * @Date: 2021-07-05 13:48:25 - * @LastEditTime: 2021-07-22 09:48:23 + * @LastEditTime: 2021-12-15 15:58:22 * @Description:  This files is for * * @Modify History: @@ -13,21 +13,21 @@ */ #include #include "ft_types.h" -#include "pl011_uart.h" +#include "fpl011.h" #include "gicv3.h" #include "interrupt.h" -static Pl011 pl011_obj; +static FPl011 pl011_obj; void Uart1Init(void) { - Pl011Config config = *Pl011LookupConfig(1); - printf("config addr: 0x%x \r\n", config.base_address); - Pl011CfgInitialize(&pl011_obj, &config); - Pl011SetOptions(&pl011_obj, FUART_OPTION_UARTEN | FUART_OPTION_RXEN | FUART_OPTION_TXEN | FUART_OPTION_FIFOEN); + FPl011Config *config = (FPl011Config *)FPl011LookupConfig(1); + printf("config addr: 0x%x \r\n", config->base_address); + FPl011CfgInitialize(&pl011_obj, config); + FPl011SetOptions(&pl011_obj, FPL011_OPTION_UARTEN | FPL011_OPTION_RXEN | FPL011_OPTION_TXEN | FPL011_OPTION_FIFOEN); } u8 BlockReceive() { - return Pl011BlockReceive(&pl011_obj); + return FPl011BlockReceive(&pl011_obj); } \ No newline at end of file diff --git a/example/function_test/src/test_uart.c_o b/example/function_test/src/test_uart.c_o new file mode 100644 index 00000000..d85825a7 --- /dev/null +++ b/example/function_test/src/test_uart.c_o @@ -0,0 +1,33 @@ +/* + * @ : Copyright (c) 2021 Phytium Information Technology, Inc. + * + * SPDX-License-Identifier: Apache-2.0. + * + * @Date: 2021-07-05 13:48:25 + * @LastEditTime: 2021-12-15 15:53:25 + * @Description:  This files is for + * + * @Modify History: + * Ver   Who        Date         Changes + * ----- ------     --------    -------------------------------------- + */ +#include +#include "ft_types.h" +#include "pl011_uart.h" +#include "gicv3.h" +#include "interrupt.h" + +static Pl011 pl011_obj; + +void Uart1Init(void) +{ + Pl011Config config = *Pl011LookupConfig(1); + printf("config addr: 0x%x \r\n", config.base_address); + Pl011CfgInitialize(&pl011_obj, &config); + Pl011SetOptions(&pl011_obj, FUART_OPTION_UARTEN | FUART_OPTION_RXEN | FUART_OPTION_TXEN | FUART_OPTION_FIFOEN); +} + +u8 BlockReceive() +{ + return Pl011BlockReceive(&pl011_obj); +} \ No newline at end of file diff --git a/install.py b/install.py index e03dcebe..1beee322 100644 --- a/install.py +++ b/install.py @@ -86,7 +86,7 @@ os.system("chmod +x ./make/*.mk --silent ") os.system("chmod +x ./lib/Kconfiglib/*.py --silent ") # Add standalone sdk -standalone_sdk_v="v0.1.15" +standalone_sdk_v="v0.1.8" standalone_path=freertos_sdk_path + '/standalone' standalone_branche="master" standalone_remote="https://gitee.com/phytium_embedded/phytium-standalone-sdk.git" diff --git a/make/complier.mk b/make/complier.mk index e874333d..d470c966 100755 --- a/make/complier.mk +++ b/make/complier.mk @@ -76,9 +76,11 @@ EXCL_SRC ?= # 在源文件目录中不编译 #OUTPUT_DIR ?= build # 输出目录 $(shell if [ ! -e $(OUTPUT_DIR) ];then mkdir -p $(OUTPUT_DIR); fi) + include $(STANDALONE_DIR)/standalone.mk include $(STANDALONE_DIR)/lib/lib.mk include $(FREERTOS_SDK_ROOT)/make/ld.mk +include $(FREERTOS_SDK_ROOT)/standalone_adaptive.mk include $(FREERTOS_SDK_ROOT)/third-party/third-party.mk @@ -112,7 +114,7 @@ APP_S_SRC := $(foreach dir, $(SRC_DIR), $(wildcard $(dir)/*.S)) OBJ_FILES := $(patsubst %, $(OUTPUT_DIR)/%, $(APP_S_SRC:.S=.o)) \ $(patsubst %, $(OUTPUT_DIR)/%, $(APP_C_SRC:.c=.o)) -EXCL_OBJS ?= $(patsubst %, $(OUTPUT_DIR)/%, $(EXCL_SRC:.c=.o)) +EXCL_OBJS ?= $(patsubst %, $(OUTPUT_DIR)/%, $(EXCL_SRC:.c=.o) $(EXCL_SRC:.S=.o)) OBJ_FILES := $(filter-out $(EXCL_OBJS), $(OBJ_FILES)) OBJ_FILES += $(LIBC) diff --git a/make/ld/Kconfig b/make/ld/Kconfig index 46a76361..b0364eba 100644 --- a/make/ld/Kconfig +++ b/make/ld/Kconfig @@ -4,7 +4,6 @@ menu "Linker Options" choice prompt "Select Linker Script Template" optional - default QEMU_AARCH32_RAM_LD if TARGET_AARCH32_QEMU config AARCH32_RAM_LD bool "Use aarch32_ram.ld" @@ -16,23 +15,6 @@ menu "Linker Options" help Use linkscript for booting AARCH64 Baremetal Image from DDR - if USE_BAREMETAL_AMP - config AARCH32_AMP_RAM_MASTER_LD - bool "Use aarch32_amp_master_ram.ld" - help - Use linkscript for booting AARCH32 Master Baremetal Image from DDR - - config AARCH32_AMP_RAM_SLAVE_LD - bool "Use aarch32_amp_slave_ram.ld" - help - Use linkscript for booting AARCH32 Slave Baremetal Image from DDR - endif - - config QEMU_AARCH32_RAM_LD - bool "Use qemu_aarch32_ram.ld" - help - Use linkscript booting AARCH32 Qemu from DDR - config USER_DEFINED_LD bool "Other link script" help @@ -81,25 +63,60 @@ menu "Linker Options" endif config HEAP_SIZE - hex "Heap Size" - default "0x100000" + int "Heap Size (MB)" + default "1" help Assign Heap size in Linkscript - if TARGET_ARMV8_AARCH32 - config STACK_SIZE - hex "Stack Size" - default "0x100000" - help - Assign Stack size in Linkscript - endif + config STACK_SIZE + hex "Stack Size (Byte)" + default "0x400" + depends on AARCH64_RAM_LD + help + Assign Stack size in Linkscript + + + config SVC_STACK_SIZE + hex "Aarch32 supervisor stack size (Byte)" + default "0x1000" + depends on AARCH32_RAM_LD + help + Assign Stack size in Linkscript + + config SYS_STACK_SIZE + hex "Aarch32 system stack size (Byte)" + default "0x1000" + depends on AARCH32_RAM_LD + help + Assign system stack size in Linkscript + + config IRQ_STACK_SIZE + hex "Aarch32 Irq stack size (Byte)" + default "0x1000" + depends on AARCH32_RAM_LD + help + Assign Irq stack size in Linkscript + + config ABORT_STACK_SIZE + hex "Aarch32 abort stack size (Byte)" + default "0x1000" + depends on AARCH32_RAM_LD + help + Assign abort stack size in Linkscript + + config FIQ_STACK_SIZE + hex "Aarch32 fiq stack size (Byte)" + default "0x1000" + depends on AARCH32_RAM_LD + help + Assign abort stack size in Linkscript + + config UNDEF_STACK_SIZE + hex "Aarch32 undef stack size (Byte)" + default "0x1000" + depends on AARCH32_RAM_LD + help + Assign undef stack size in Linkscript - if TARGET_ARMV8_AARCH64 - config STACK_TOP_ADDR - hex "Stack Top Address" - default "0x82000000" - help - Assign Stack top address in Linkscript - endif endmenu diff --git a/make/ld/aarch32_ram.ld b/make/ld/aarch32_ram.ld index 9d1ff192..590de49c 100644 --- a/make/ld/aarch32_ram.ld +++ b/make/ld/aarch32_ram.ld @@ -3,14 +3,9 @@ OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") OUTPUT_ARCH(arm) -ENTRY(Startup_Aarch32) +ENTRY(_boot) -HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : CONFIG_HEAP_SIZE; - -/* pretend that 0x80100000 is ROM, 0x81000000 is RAM */ -/* because vexpress-qemu is not able to emulate flash memory as ROM */ -/* space is significant to avoid syntax error when linking */ MEMORY { ROM (rx) : ORIGIN = CONFIG_ROM_START_UP_ADDR, LENGTH = CONFIG_ROM_SIZE_MB * 1M @@ -19,95 +14,116 @@ MEMORY SECTIONS { + .vectors : { + *(.boot) + . = ALIGN(64); + KEEP(*(.vectors)) + + } > ROM + .text : { - _text_start = .; - KEEP(*(.Startup_Aarch32)) - *(.vector_table) *(.text*) - *(.rodata*) /* make life easier without rodata section */ + *(.gnu.linkonce.t.*) + *(.plt) + *(.gnu_warning) + *(.gcc_execpt_table) *(.glue_7) /* glue arm to thumb code */ *(.glue_7t) /* glue thumb to arm code */ + *(.vfp11_veneer) + *(.ARM.extab) + *(.gnu.linkonce.armextab.*) + *(.note.gnu.build-id) } > ROM /* .text should linked to ROM */ . = ALIGN(8); /* .ARM.exidx is sorted, so has to go in its own output section. */ - .ARM : - { + .ARM :{ *(.ARM.exidx* .gnu.linkonce.armexidx.*) /* This is used by the startup in order to initialize the .data secion */ } > ROM - - .rodata : - { - *(.rodata .rodata.* .gnu.linkonce.r.*) - - . = ALIGN(8); + + .interp : { + KEEP (*(.interp)) + } > ROM + + .note-ABI-tag : { + KEEP (*(.note-ABI-tag)) + } > ROM + + .rodata :{ + __rodata_start = .; + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r.*) + __rodata_end = .; + } > ROM + + .rodata1 : { + __rodata1_start = .; + *(.rodata1) + *(.rodata1.*) + __rodata1_end = .; + } > ROM + + .le_shell (ALIGN(64)):{ + . = ALIGN(4096); _shell_command_start = .; KEEP (*(shellCommand)) - _shell_command_end = .; - } > ROM + _shell_command_end = .; + . = ALIGN(4096); /* align to page size */ + _shell_code_end = .; + }> ROM - .init : - { + .init :{ KEEP (*(SORT_NONE(.init))) }> ROM - .fini : - { + .fini :{ KEEP (*(SORT_NONE(.fini))) }> ROM - .eh_frame : - { + .eh_frame :{ KEEP (*(.eh_frame)) }> ROM - .ARM.extab : - { + .ARM.extab :{ *(.ARM.extab* .gnu.linkonce.armextab.*) }> ROM - .ARM.exidx : - { + .ARM.exidx :{ __exidx_start = .; *(.ARM.exidx* .gnu.linkonce.armexidx.*) __exidx_end = .; }> ROM - .fini_array : - { + .fini_array :{ PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(SORT(.fini_array.*))) KEEP (*(.fini_array )) PROVIDE_HIDDEN (__fini_array_end = .); }> ROM - .dtors : - { + .dtors :{ KEEP (*crtbegin.o(.dtors)) KEEP (*crtbegin?.o(.dtors)) KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) . = ALIGN(16); - _rom_end = .; + __rom_end__ = .; }> ROM - - . = ALIGN(4096); /* align to page size */ - _text_end = .; - /* data segment, contains data that can be modified by the program at run-time, global and static variables that have a non-zero initial value will normally go here */ - .data : AT(_text_end){ - _data_start = .; /* .data section will be redise at runtime */ + .data : AT(__rom_end__){ + __data_start__ = .; /* .data section will be redise at runtime */ *(.data) . = ALIGN(4096); /* align to page size */ - _data_end = .; + __data_end__ = .; } > RAM /* link it all to RAM */ /* unitialized data segment, variables explicitly initialized with zero to BSS */ - .bss : { + .bss (NOLOAD): { __bss_start__ = .; _bss_start = __bss_start__; *(.bss) @@ -115,33 +131,58 @@ SECTIONS _bss_end = __bss_end__; } > RAM - .heap : - { - . = ALIGN(8); + .sbss (NOLOAD) : { + __sbss_start__ = .; + *(.sbss) + *(.sbss.*) + *(.gnu.linkonce.sb.*) + __sbss_end__ = .; + } > RAM + + .heap (NOLOAD):{ + . = ALIGN(16); __end__ = .; PROVIDE(end = .); HeapBase = .; _heap_start = .; - . += HEAP_SIZE; + . += CONFIG_HEAP_SIZE* 1M; _heap_end = .; HeapLimit = .; /* Add for _sbrk */ } > RAM - _fiq_stack_start = ADDR(.heap) + SIZEOF(.heap); - _fiq_stack_end = _fiq_stack_start + CONFIG_STACK_SIZE; /* 64 KB */ + .stack (NOLOAD):{ + + . = ALIGN(16); + _supervisor_stack_end = .; + . += CONFIG_SVC_STACK_SIZE; + _supervisor_stack = .; + __supervisor_stack = _supervisor_stack; + + . = ALIGN(16); + _irq_stack_end = .; + . += CONFIG_IRQ_STACK_SIZE; + __irq_stack = .; + + __sys_stack = .; + . += CONFIG_SYS_STACK_SIZE; + . = ALIGN(16); + __sys_stack = .; + + _abort_stack_end = .; + . += CONFIG_ABORT_STACK_SIZE; + . = ALIGN(16); + __abort_stack = .; - _irq_stack_start = _fiq_stack_end; - _irq_stack_end = _irq_stack_start + CONFIG_STACK_SIZE; /* 64 KB */ + _fiq_stack_end = .; + . += CONFIG_FIQ_STACK_SIZE; + . = ALIGN(16); + __fiq_stack = .; - _sys_stack_start = _irq_stack_end; - _sys_stack_end = _sys_stack_start + CONFIG_STACK_SIZE; /* 64 KB */ + _undef_stack_end = .; + . += CONFIG_UNDEF_STACK_SIZE; + . = ALIGN(16); + __undef_stack = .; - /* put svc at end and start up with SVC mode */ - _svc_stack_start = _sys_stack_end; - _svc_stack_end = _svc_stack_start + CONFIG_STACK_SIZE; /* 64 KB */ + } > RAM - _irq_stack_size = _irq_stack_end - _irq_stack_start; - _fiq_stack_size = _fiq_stack_end - _fiq_stack_start; - _sys_stack_size = _sys_stack_end - _sys_stack_start; - _svc_stack_size = _svc_stack_end - _svc_stack_start; } diff --git a/make/ld/aarch64_ram.ld b/make/ld/aarch64_ram.ld index ea919ee5..662a5365 100644 --- a/make/ld/aarch64_ram.ld +++ b/make/ld/aarch64_ram.ld @@ -1,127 +1,169 @@ #include "sdkconfig.h" -ENTRY(_boot) - MEMORY { -#if defined(CONFIG_LINK_SCRIPT_ROM) ROM (rx) : ORIGIN = CONFIG_ROM_START_UP_ADDR, LENGTH = CONFIG_ROM_SIZE_MB * 1M -#endif -#if defined(CONFIG_LINK_SCRIPT_RAM) RAM (rwx): ORIGIN = CONFIG_RAM_START_UP_ADDR, LENGTH = CONFIG_RAM_SIZE_MB * 1M -#endif } +ENTRY(_vector_table) SECTIONS { + .text : { + KEEP (*(.vectors)) + *(.boot) + *(.text) + *(.text.*) + *(.gnu.linkonce.t.*) + *(.plt) + *(.gnu_warning) + *(.gcc_execpt_table) + *(.glue_7) + *(.glue_7t) + *(.ARM.extab) + *(.gnu.linkonce.armextab.*) + } > ROM - .text : - { - KEEP(*(.StartUp)) - KEEP(*(.vectors)) - KEEP(*(.text.boot)) - *(.text) - . = ALIGN(8); - }> ROM + .got : { + *(.got) + } > ROM + .got1 : { + *(.got1) + } > ROM - .rodata : - { - *(.rodata .rodata.* .gnu.linkonce.r.*) + .got2 : { + *(.got2) + } > ROM - . = ALIGN(8); - _shell_command_start = .; - KEEP (*(shellCommand)) - _shell_command_end = .; + .note.gnu.build-id : { + KEEP (*(.note.gnu.build-id)) } > ROM - .init : - { - KEEP (*(SORT_NONE(.init))) - }> ROM + .init (ALIGN(64)): { + KEEP (*(.init)) + } > ROM - .fini : - { - KEEP (*(SORT_NONE(.fini))) - }> ROM + .fini (ALIGN(64)): { + KEEP (*(.fini)) + } > ROM - .eh_frame : - { - KEEP (*(.eh_frame)) - }> ROM + .interp : { + __interp_start = .; + KEEP (*(.interp)) + __interp_end = .; + } > ROM - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - }> ROM + .note-ABI-tag : { + __note-ABI-tag_start = .; + KEEP (*(.note-ABI-tag)) + __note-ABI-tag_end = .; + } > ROM - .ARM.exidx : - { - __exidx_start = .; - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - __exidx_end = .; - }> ROM + .preinit_array : { + __preinit_array_start = .; + KEEP (*(SORT(.preinit_array.*))) + KEEP (*(.preinit_array)) + __preinit_array_end = .; + } > ROM - .fini_array : - { - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP (*(SORT(.fini_array.*))) - KEEP (*(.fini_array )) - PROVIDE_HIDDEN (__fini_array_end = .); - }> ROM + .init_array : { + __init_array_start = .; + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + __init_array_end = .; + } > ROM - .dtors : - { - KEEP (*crtbegin.o(.dtors)) - KEEP (*crtbegin?.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - . = ALIGN(16); - _rom_end = .; + .fini_array : { + __fini_array_start = .; + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array)) + __fini_array_end = .; + } > ROM + + .rodata (ALIGN(64)): { + __rodata_start = .; + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r.*) + __rodata_end = .; + } > ROM + + .le_shell (ALIGN(64)):{ + . = ALIGN(4096); + _shell_command_start = .; + KEEP (*(shellCommand)) + _shell_command_end = .; + . = ALIGN(4096); /* align to page size */ + _shell_code_end = .; }> ROM - .data :AT(ADDR(.dtors) + SIZEOF(.dtors)) - { - __data_start = .; - *(.data) - *(.data .data.* .gnu.linkonce.d.*) - SORT(CONSTRUCTORS) + + .rodata1 (ALIGN(64)): { + __rodata1_start = .; + *(.rodata1) + *(.rodata1.*) + __rodata1_end = .; + } > ROM + + + .gcc_except_table : { + *(.gcc_except_table) + . = ALIGN(16); + __rom_end__ = .; + } > ROM + + + .data :AT(ADDR(.gcc_except_table) + SIZEOF(.gcc_except_table)){ + __data_start__ = .; + *(.data) + *(.data.*) + *(.gnu.linkonce.d.*) + *(.jcr) + *(.got) + *(.got.plt) . = ALIGN(4096); /* align to page size */ - __data_end = .; - }> RAM + __data_end__ = .; + } > RAM + .sbss (NOLOAD) : { + __sbss_start__ = .; + *(.sbss) + *(.sbss.*) + *(.gnu.linkonce.sb.*) + __sbss_end__ = .; + } > RAM + .bss (NOLOAD) : { + . = ALIGN(64); + __bss_start__ = .; + *(.bss) + *(.bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + . = ALIGN(64); + __bss_end__ = .; + } > RAM - .bss : - { - . = ALIGN(8); - __bss_start__ = .; - __bss_start = __bss_start__; - bss = .; - *(.bss) - . = ALIGN(8); - __bss_end__ = .; - __bss_end = __bss_end__; - }> RAM - .heap (NOLOAD): - { + .heap (NOLOAD):{ . = ALIGN(64); - __end__ = .; - PROVIDE(end = .); + _heap = .; HeapBase = .; _heap_start = .; - . = . + CONFIG_HEAP_SIZE; + . = . + CONFIG_HEAP_SIZE* 1M; _heap_end = .; HeapLimit = .; } > RAM - . = CONFIG_STACK_TOP_ADDR ; /* stack memory */ - stack_top = .; + .stack (NOLOAD) : { + . = ALIGN(64); + _el1_stack_end = .; + . += CONFIG_STACK_SIZE; + __el1_stack = .; + } > RAM } -__bss_size = (__bss_end - __bss_start)>>3; \ No newline at end of file diff --git a/make/ld_o/Kconfig b/make/ld_o/Kconfig new file mode 100644 index 00000000..46a76361 --- /dev/null +++ b/make/ld_o/Kconfig @@ -0,0 +1,105 @@ +# entry of menuconfig + +menu "Linker Options" + choice + prompt "Select Linker Script Template" + optional + default QEMU_AARCH32_RAM_LD if TARGET_AARCH32_QEMU + + config AARCH32_RAM_LD + bool "Use aarch32_ram.ld" + help + Use linkscript for booting AARCH32 Baremetal Image from DDR + + config AARCH64_RAM_LD + bool "Use aarch64_ram.ld" + help + Use linkscript for booting AARCH64 Baremetal Image from DDR + + if USE_BAREMETAL_AMP + config AARCH32_AMP_RAM_MASTER_LD + bool "Use aarch32_amp_master_ram.ld" + help + Use linkscript for booting AARCH32 Master Baremetal Image from DDR + + config AARCH32_AMP_RAM_SLAVE_LD + bool "Use aarch32_amp_slave_ram.ld" + help + Use linkscript for booting AARCH32 Slave Baremetal Image from DDR + endif + + config QEMU_AARCH32_RAM_LD + bool "Use qemu_aarch32_ram.ld" + help + Use linkscript booting AARCH32 Qemu from DDR + + config USER_DEFINED_LD + bool "Other link script" + help + Use other link script provided by User + + endchoice + + config LINK_SCRIPT_ROM + bool "Allocate ROM" + default y + help + Allocate ROM for link scripts + + if LINK_SCRIPT_ROM + config ROM_START_UP_ADDR + hex "ROM Start up Address" + default "0x80100000" + help + Assign Start up Address for ROM in Linkscript + + config ROM_SIZE_MB + int "ROM Size (MB)" + default "1" + help + Assign ROM size for Master Core in Linkscript + endif + + config LINK_SCRIPT_RAM + bool "Allocate RAM" + default y + help + Allocate RAM for link scripts + + if LINK_SCRIPT_RAM + config RAM_START_UP_ADDR + hex "RAM Start up Address" + default "0x81000000" + help + Assign Start up Address for RAM in Linkscript + + config RAM_SIZE_MB + int "RAM Size (MB)" + default "64" + help + Assign RAM size in Linkscript + endif + + config HEAP_SIZE + hex "Heap Size" + default "0x100000" + help + Assign Heap size in Linkscript + + if TARGET_ARMV8_AARCH32 + config STACK_SIZE + hex "Stack Size" + default "0x100000" + help + Assign Stack size in Linkscript + endif + + if TARGET_ARMV8_AARCH64 + config STACK_TOP_ADDR + hex "Stack Top Address" + default "0x82000000" + help + Assign Stack top address in Linkscript + endif +endmenu + diff --git a/make/ld_o/aarch32_ram.ld b/make/ld_o/aarch32_ram.ld new file mode 100644 index 00000000..9d1ff192 --- /dev/null +++ b/make/ld_o/aarch32_ram.ld @@ -0,0 +1,147 @@ +#include "sdkconfig.h" + +OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") +OUTPUT_ARCH(arm) + +ENTRY(Startup_Aarch32) + + +HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : CONFIG_HEAP_SIZE; + +/* pretend that 0x80100000 is ROM, 0x81000000 is RAM */ +/* because vexpress-qemu is not able to emulate flash memory as ROM */ +/* space is significant to avoid syntax error when linking */ +MEMORY +{ + ROM (rx) : ORIGIN = CONFIG_ROM_START_UP_ADDR, LENGTH = CONFIG_ROM_SIZE_MB * 1M + RAM (rwx): ORIGIN = CONFIG_RAM_START_UP_ADDR, LENGTH = CONFIG_RAM_SIZE_MB * 1M +} + +SECTIONS +{ + .text : { + _text_start = .; + KEEP(*(.Startup_Aarch32)) + *(.vector_table) + *(.text*) + *(.rodata*) /* make life easier without rodata section */ + *(.glue_7) /* glue arm to thumb code */ + *(.glue_7t) /* glue thumb to arm code */ + } > ROM /* .text should linked to ROM */ + . = ALIGN(8); + + /* .ARM.exidx is sorted, so has to go in its own output section. */ + .ARM : + { + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + /* This is used by the startup in order to initialize the .data secion */ + } > ROM + + .rodata : + { + *(.rodata .rodata.* .gnu.linkonce.r.*) + + . = ALIGN(8); + _shell_command_start = .; + KEEP (*(shellCommand)) + _shell_command_end = .; + } > ROM + + .init : + { + KEEP (*(SORT_NONE(.init))) + }> ROM + + .fini : + { + KEEP (*(SORT_NONE(.fini))) + }> ROM + + .eh_frame : + { + KEEP (*(.eh_frame)) + }> ROM + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + }> ROM + + .ARM.exidx : + { + __exidx_start = .; + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + __exidx_end = .; + }> ROM + + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array )) + PROVIDE_HIDDEN (__fini_array_end = .); + }> ROM + + .dtors : + { + KEEP (*crtbegin.o(.dtors)) + KEEP (*crtbegin?.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + . = ALIGN(16); + _rom_end = .; + }> ROM + + + . = ALIGN(4096); /* align to page size */ + _text_end = .; + + /* data segment, contains data that can be modified by the program at run-time, + global and static variables that have a non-zero initial value will normally go here */ + .data : AT(_text_end){ + _data_start = .; /* .data section will be redise at runtime */ + *(.data) + . = ALIGN(4096); /* align to page size */ + _data_end = .; + } > RAM /* link it all to RAM */ + + /* unitialized data segment, variables explicitly initialized with zero to BSS */ + .bss : { + __bss_start__ = .; + _bss_start = __bss_start__; + *(.bss) + __bss_end__ = .; + _bss_end = __bss_end__; + } > RAM + + .heap : + { + . = ALIGN(8); + __end__ = .; + PROVIDE(end = .); + HeapBase = .; + _heap_start = .; + . += HEAP_SIZE; + _heap_end = .; + HeapLimit = .; /* Add for _sbrk */ + } > RAM + + _fiq_stack_start = ADDR(.heap) + SIZEOF(.heap); + _fiq_stack_end = _fiq_stack_start + CONFIG_STACK_SIZE; /* 64 KB */ + + _irq_stack_start = _fiq_stack_end; + _irq_stack_end = _irq_stack_start + CONFIG_STACK_SIZE; /* 64 KB */ + + _sys_stack_start = _irq_stack_end; + _sys_stack_end = _sys_stack_start + CONFIG_STACK_SIZE; /* 64 KB */ + + /* put svc at end and start up with SVC mode */ + _svc_stack_start = _sys_stack_end; + _svc_stack_end = _svc_stack_start + CONFIG_STACK_SIZE; /* 64 KB */ + + _irq_stack_size = _irq_stack_end - _irq_stack_start; + _fiq_stack_size = _fiq_stack_end - _fiq_stack_start; + _sys_stack_size = _sys_stack_end - _sys_stack_start; + _svc_stack_size = _svc_stack_end - _svc_stack_start; +} diff --git a/make/ld_o/aarch64_ram.ld b/make/ld_o/aarch64_ram.ld new file mode 100644 index 00000000..ea919ee5 --- /dev/null +++ b/make/ld_o/aarch64_ram.ld @@ -0,0 +1,127 @@ +#include "sdkconfig.h" + +ENTRY(_boot) + +MEMORY +{ +#if defined(CONFIG_LINK_SCRIPT_ROM) + ROM (rx) : ORIGIN = CONFIG_ROM_START_UP_ADDR, LENGTH = CONFIG_ROM_SIZE_MB * 1M +#endif +#if defined(CONFIG_LINK_SCRIPT_RAM) + RAM (rwx): ORIGIN = CONFIG_RAM_START_UP_ADDR, LENGTH = CONFIG_RAM_SIZE_MB * 1M +#endif +} + + +SECTIONS +{ + + .text : + { + KEEP(*(.StartUp)) + KEEP(*(.vectors)) + KEEP(*(.text.boot)) + *(.text) + . = ALIGN(8); + }> ROM + + + .rodata : + { + *(.rodata .rodata.* .gnu.linkonce.r.*) + + . = ALIGN(8); + _shell_command_start = .; + KEEP (*(shellCommand)) + _shell_command_end = .; + } > ROM + + .init : + { + KEEP (*(SORT_NONE(.init))) + }> ROM + + .fini : + { + KEEP (*(SORT_NONE(.fini))) + }> ROM + + .eh_frame : + { + KEEP (*(.eh_frame)) + }> ROM + + .ARM.extab : + { + *(.ARM.extab* .gnu.linkonce.armextab.*) + }> ROM + + .ARM.exidx : + { + __exidx_start = .; + *(.ARM.exidx* .gnu.linkonce.armexidx.*) + __exidx_end = .; + }> ROM + + .fini_array : + { + PROVIDE_HIDDEN (__fini_array_start = .); + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array )) + PROVIDE_HIDDEN (__fini_array_end = .); + }> ROM + + .dtors : + { + KEEP (*crtbegin.o(.dtors)) + KEEP (*crtbegin?.o(.dtors)) + KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) + KEEP (*(SORT(.dtors.*))) + KEEP (*(.dtors)) + . = ALIGN(16); + _rom_end = .; + }> ROM + + .data :AT(ADDR(.dtors) + SIZEOF(.dtors)) + { + __data_start = .; + *(.data) + *(.data .data.* .gnu.linkonce.d.*) + SORT(CONSTRUCTORS) + . = ALIGN(4096); /* align to page size */ + __data_end = .; + }> RAM + + + + .bss : + { + . = ALIGN(8); + __bss_start__ = .; + __bss_start = __bss_start__; + bss = .; + *(.bss) + . = ALIGN(8); + __bss_end__ = .; + __bss_end = __bss_end__; + }> RAM + + .heap (NOLOAD): + { + . = ALIGN(64); + __end__ = .; + PROVIDE(end = .); + HeapBase = .; + _heap_start = .; + . = . + CONFIG_HEAP_SIZE; + _heap_end = .; + HeapLimit = .; + } > RAM + + + . = CONFIG_STACK_TOP_ADDR ; /* stack memory */ + stack_top = .; + + +} +__bss_size = (__bss_end - __bss_start)>>3; \ No newline at end of file diff --git a/standalone b/standalone new file mode 160000 index 00000000..49cf0988 --- /dev/null +++ b/standalone @@ -0,0 +1 @@ +Subproject commit 49cf098844a142d23344253410856a727a36b416 diff --git a/standalone_adaptive.mk b/standalone_adaptive.mk new file mode 100644 index 00000000..f40f83ce --- /dev/null +++ b/standalone_adaptive.mk @@ -0,0 +1,10 @@ + +EXCL_SRC += $(FREERTOS_SDK_ROOT)/standalone/common/fmemory_pool.c + + +ifdef CONFIG_TARGET_ARMV8_AARCH64 +EXCL_SRC += $(FREERTOS_SDK_ROOT)/standalone/arch/armv8/aarch64/gcc/vectors.S +EXCL_SRC += $(FREERTOS_SDK_ROOT)/standalone/arch/armv8/aarch64/gcc/vectors_g.c +else +EXCL_SRC += $(FREERTOS_SDK_ROOT)/standalone/arch/armv8/aarch32/gcc/vector.S +endif diff --git a/standalone_o b/standalone_o new file mode 160000 index 00000000..2522fab8 --- /dev/null +++ b/standalone_o @@ -0,0 +1 @@ +Subproject commit 2522fab8c06978215386c47178b09d01f893e174 diff --git a/third-party/freertos/portable/GCC/ft_platform/aarch32/FreeRTOSConfig.h b/third-party/freertos/portable/GCC/ft_platform/aarch32/FreeRTOSConfig.h index 7d013424..71a59afd 100644 --- a/third-party/freertos/portable/GCC/ft_platform/aarch32/FreeRTOSConfig.h +++ b/third-party/freertos/portable/GCC/ft_platform/aarch32/FreeRTOSConfig.h @@ -205,8 +205,8 @@ nothing to return to. To avoid this define configTASK_RETURN_ADDRESS to 0. */ vClearTickInterrupt(); \ }while (0) -#define FreeRTOS_IRQ_Handler IRQ_Handler -#define FreeRTOS_SWI_Handler SWI_Handler +#define FreeRTOS_IRQ_Handler IRQHandler +#define FreeRTOS_SWI_Handler SWIHandler #define configINTERRUPT_CONTROLLER_BASE_ADDRESS (0x71800000) #define configINTERRUPT_CONTROLLER_CPU_INTERFACE_OFFSET (0x2000UL) diff --git a/third-party/freertos/portable/GCC/ft_platform/aarch32/vector.S b/third-party/freertos/portable/GCC/ft_platform/aarch32/vector.S new file mode 100644 index 00000000..d7615cf2 --- /dev/null +++ b/third-party/freertos/portable/GCC/ft_platform/aarch32/vector.S @@ -0,0 +1,80 @@ +.globl _boot +.globl _vector_table + +.globl FiqInterruptHandler +.globl DataAbortInterruptHandler +.globl PrefetchAbortInterruptHandler +.globl UndefineInterruptHandler + + +.set EXCEPTION_FRAME_SIZE, (17*4) + +/* allocatable and executable */ +.section .vectors, "a" + +_vector_table: + B _boot + B Undefined + B SWIHandler + B PrefetchAbortHandler + B DataAbortHandler + NOP /* Placeholder for address exception vector*/ + B IRQHandler + B FiqHandler + + + + +.macro PushExceptionReg + sub sp, sp, #EXCEPTION_FRAME_SIZE /* Sizeof(ExceptionFrame) */ + stmia sp, {r0 - r12} /* Calling r0-r12 */ + mov r0, sp + mrs r6, spsr /* Save CPSR */ + str lr, [r0, #15*4] /* Push PC */ + str r6, [r0, #16*4] /* Push CPSR */ + cps #0x13 /* C运行环境所运行的模式 */ + str sp, [r0, #13*4] /* Save calling SP */ + str lr, [r0, #14*4] /* Save calling PC */ +.endm + + + +.align 4 +.arm +.weak IRQHandler +.type IRQHandler, %function +@.global IRQHandler +IRQHandler: /* 0x18 IRQ */ + bl IRQHandler + bl . + + +.align 4 +.arm +.weak SWIHandler +.type SWIHandler, %function +@.global SWIHandler +SWIHandler: /* 0x18 IRQ */ + bl SWIHandler + bl . + +Undefined: /* Undefined handler */ + PushExceptionReg + cps #0x1B + bl UndefineInterruptHandler + bl . + +PrefetchAbortHandler: + PushExceptionReg + bl PrefetchAbortInterruptHandler + bl . + +DataAbortHandler: + PushExceptionReg + bl DataAbortInterruptHandler + bl . + +FiqHandler: /* FIQ vector handler */ + PushExceptionReg + bl FiqInterruptHandler + bl . \ No newline at end of file diff --git a/third-party/freertos/portable/GCC/ft_platform/aarch64/FreeRTOSConfig.h b/third-party/freertos/portable/GCC/ft_platform/aarch64/FreeRTOSConfig.h index 07566640..45ec5d24 100644 --- a/third-party/freertos/portable/GCC/ft_platform/aarch64/FreeRTOSConfig.h +++ b/third-party/freertos/portable/GCC/ft_platform/aarch64/FreeRTOSConfig.h @@ -188,4 +188,8 @@ QEMU-Virt. */ #define configUSE_TRACE_FACILITY 1 + +#define FreeRTOS_IRQ_Handler IRQInterruptHandler +#define FreeRTOS_SWI_Handler SynchronousInterruptHandler + #endif /* FREERTOS_CONFIG_H */ diff --git a/third-party/freertos/portable/GCC/ft_platform/aarch64/port.c b/third-party/freertos/portable/GCC/ft_platform/aarch64/port.c index 0798bcaf..307d5ba0 100644 --- a/third-party/freertos/portable/GCC/ft_platform/aarch64/port.c +++ b/third-party/freertos/portable/GCC/ft_platform/aarch64/port.c @@ -323,7 +323,6 @@ BaseType_t xPortStartScheduler(void) /* Start the timer that generates the tick ISR. */ configSETUP_TICK_INTERRUPT(); - /* Start the first task executing. */ vPortRestoreTaskContext(); } diff --git a/third-party/freertos/portable/GCC/ft_platform/aarch64/portASM.S b/third-party/freertos/portable/GCC/ft_platform/aarch64/portASM.S index 5530452f..077ef23a 100644 --- a/third-party/freertos/portable/GCC/ft_platform/aarch64/portASM.S +++ b/third-party/freertos/portable/GCC/ft_platform/aarch64/portASM.S @@ -39,7 +39,7 @@ .extern ullPortYieldRequired .extern ullICCEOIR .extern ullICCIAR - .extern _freertos_vector_table + .extern _vector_table .global FreeRTOS_IRQ_Handler .global FreeRTOS_SWI_Handler @@ -257,7 +257,7 @@ FreeRTOS_Abort: .align 8 .type vPortRestoreTaskContext, %function vPortRestoreTaskContext: -.set freertos_vector_base, _freertos_vector_table +.set freertos_vector_base, _vector_table /* Install the FreeRTOS interrupt handlers. */ LDR X1, =freertos_vector_base diff --git a/third-party/freertos/portable/GCC/ft_platform/aarch64/portAsm_debug.c b/third-party/freertos/portable/GCC/ft_platform/aarch64/portAsm_debug.c new file mode 100644 index 00000000..5384a889 --- /dev/null +++ b/third-party/freertos/portable/GCC/ft_platform/aarch64/portAsm_debug.c @@ -0,0 +1,22 @@ +/* + * @ : Copyright (c) 2021 Phytium Information Technology, Inc. + * + * SPDX-License-Identifier: Apache-2.0. + * + * @Date: 2021-12-15 17:24:04 + * @LastEditTime: 2021-12-15 17:28:22 + * @Description:  This files is for + * + * @Modify History: + * Ver   Who        Date         Changes + * ----- ------     --------    -------------------------------------- + */ + + +#include "stdio.h" + +void test_value(void * x0 ,void * x1,void * x2 ,void * x3) +{ + printf("x2 %p \r\n",x2) ; + while (1) ; +} \ No newline at end of file diff --git a/third-party/freertos/portable/GCC/ft_platform/aarch64/vectors.S b/third-party/freertos/portable/GCC/ft_platform/aarch64/vectors.S new file mode 100644 index 00000000..95bcc7ec --- /dev/null +++ b/third-party/freertos/portable/GCC/ft_platform/aarch64/vectors.S @@ -0,0 +1,260 @@ + +.globl _boot +.globl _vector_table + +.globl FiqInterrupt +.globl IrqInterrupt +.globl SerrorInterrupt +.globl SynchronousInterrupt +.globl fpu_status + + + + +.macro SaveRegister + stp X0,X1, [sp,#-0x10]! + stp X2,X3, [sp,#-0x10]! + stp X4,X5, [sp,#-0x10]! + stp X6,X7, [sp,#-0x10]! + stp X8,X9, [sp,#-0x10]! + stp X10,X11, [sp,#-0x10]! + stp X12,X13, [sp,#-0x10]! + stp X14,X15, [sp,#-0x10]! + stp X16,X17, [sp,#-0x10]! + stp X18,X19, [sp,#-0x10]! + stp X29,X30, [sp,#-0x10]! +.endm + + +.macro RestoreRegister + ldp X29,X30, [sp], #0x10 + ldp X18,X19, [sp], #0x10 + ldp X16,X17, [sp], #0x10 + ldp X14,X15, [sp], #0x10 + ldp X12,X13, [sp], #0x10 + ldp X10,X11, [sp], #0x10 + ldp X8,X9, [sp], #0x10 + ldp X6,X7, [sp], #0x10 + ldp X4,X5, [sp], #0x10 + ldp X2,X3, [sp], #0x10 + ldp X0,X1, [sp], #0x10 +.endm + + +.macro SaveFloatregister + bl FloatSave +/* Load the floating point context array address from fpu_context_base */ + ldr x1,=fpu_context_base + ldr x0, [x1] + +/* Save all the floating point register to the array */ + stp q0,q1, [x0], #0x20 + stp q2,q3, [x0], #0x20 + stp q4,q5, [x0], #0x20 + stp q6,q7, [x0], #0x20 + stp q8,q9, [x0], #0x20 + stp q10,q11, [x0], #0x20 + stp q12,q13, [x0], #0x20 + stp q14,q15, [x0], #0x20 + stp q16,q17, [x0], #0x20 + stp q18,q19, [x0], #0x20 + stp q20,q21, [x0], #0x20 + stp q22,q23, [x0], #0x20 + stp q24,q25, [x0], #0x20 + stp q26,q27, [x0], #0x20 + stp q28,q29, [x0], #0x20 + stp q30,q31, [x0], #0x20 + mrs x2, FPCR + mrs x3, FPSR + stp x2, x3, [x0], #0x10 + +/* Save current address of floating point context array to fpu_context_base */ + str x0, [x1] +.endm + +.macro RestoreFloatRegister + +/* Restore the address of floating point context array from fpu_context_base */ + ldr x1,=fpu_context_base + ldr x0, [x1] + +/* Restore all the floating point register from the array */ + ldp x2, x3, [x0,#-0x10]! + msr FPCR, x2 + msr FPSR, x3 + ldp q30,q31, [x0,#-0x20]! + ldp q28,q29, [x0,#-0x20]! + ldp q26,q27, [x0,#-0x20]! + ldp q24,q25, [x0,#-0x20]! + ldp q22,q23, [x0,#-0x20]! + ldp q20,q21, [x0,#-0x20]! + ldp q18,q19, [x0,#-0x20]! + ldp q16,q17, [x0,#-0x20]! + ldp q14,q15, [x0,#-0x20]! + ldp q12,q13, [x0,#-0x20]! + ldp q10,q11, [x0,#-0x20]! + ldp q8,q9, [x0,#-0x20]! + ldp q6,q7, [x0,#-0x20]! + ldp q4,q5, [x0,#-0x20]! + ldp q2,q3, [x0,#-0x20]! + ldp q0,q1, [x0,#-0x20]! + +/* Save current address of floating point context array to fpu_context_base */ + str x0, [x1] +.endm + +.org 0 + +.section .vectors, "a" + +_vector_table: +.set VBAR, _vector_table +.org VBAR + + b _boot +.org (VBAR + 0x200) + b FreeRTOS_SWI_Handler + +.org (VBAR + 0x280) + b FreeRTOS_IRQ_Handler + +.org (VBAR + 0x300) + b FIQInterruptHandler + +.org (VBAR + 0x380) + b SErrorInterruptHandler + +.weak SynchronousInterruptHandler +.type SynchronousInterruptHandler, %function +SynchronousInterruptHandler: + SaveRegister +/* Check if the Synchronous abort is occurred due to floating point access. */ + mrs x0, ESR_EL1 + + and x0, x0, #(0x3F << 26) + mov x1, #(0x7 << 26) + cmp x0, x1 +/* If exception is not due to floating point access go to synchronous handler */ + bne Synchronoushandler + +/* + * If excpetion occurred due to floating point access, Enable the floating point + * access i.e. do not trap floating point instruction + */ + + mrs x1,CPACR_EL1 + orr x1, x1, #(0x1<<20) + msr CPACR_EL1, x1 + isb + +/* If the floating point access was previously enabled, store FPU context + * registers(StoreFloat). + */ + ldr x0, =fpu_status + ldrb w1,[x0] + cbnz w1, StoreFloat +/* + * If the floating point access was not enabled previously, save the status of + * floating point accessibility i.e. enabled and store floating point context + * array address(fpu_context) to fpu_context_base. + */ + mov w1, #0x1 + strb w1, [x0] + ldr x0, =fpu_context + ldr x1, =fpu_context_base + str x0,[x1] + b RestoreContext +StoreFloat: + SaveFloatRegister + b RestoreContext +Synchronoushandler: /* 此处还需要进行压栈处理,位函数内提供打印信息 */ + mrs x0, CPACR_EL1 + mrs x1, ELR_EL1 + mrs x2, SPSR_EL1 + stp x0, x1, [sp,#-0x10]! + mov x21, sp + add x21, x21, #208 + stp x21,x21, [sp,#-0x10]! + mov x0, sp + + bl SynchronousInterrupt +RestoreContext: + RestoreRegister + eret + +.weak IRQInterruptHandler +.type IRQInterruptHandler, %function +IRQInterruptHandler: + SaveRegister +/* Save the status of SPSR, ELR and CPTR to stack */ + mrs x0, CPACR_EL1 + mrs x1, ELR_EL1 + mrs x2, SPSR_EL1 + + stp x0, x1, [sp,#-0x10]! + str x2, [sp,#-0x10]! + +/* Trap floating point access */ + mrs x1,CPACR_EL1 + bic x1, x1, #(0x1<<20) + msr CPACR_EL1, x1 + isb + + bl IRQInterrupt +/* + * If floating point access is enabled during interrupt handling, + * restore floating point registers. + */ + mrs x0,CPACR_EL1 + ands x0, x0, #(0x1<<20) + beq RestorePrevState + + RestoreFloatRegister + +/* Restore the status of SPSR, ELR and CPTR from stack */ +RestorePrevState: + ldr x2,[sp],0x10 + ldp x0, x1, [sp],0x10 + + msr CPACR_EL1, x0 + msr ELR_EL1, x1 + msr SPSR_EL1, x2 + + RestoreRegister + eret + +FIQInterruptHandler: + + SaveRegister + + bl FIQInterrupt + + RestoreRegister + + eret + +SErrorInterruptHandler: + + SaveRegister + /* Save the status of SPSR, ELR and CPTR to stack */ + mrs x0, CPACR_EL1 + mrs x1, ELR_EL1 + mrs x2, SPSR_EL1 + stp x0, x1, [sp,#-0x10]! + mov x21, sp + add x21, x21, #208 + stp x21,x21, [sp,#-0x10]! + mov x0, sp + + mov x0, sp + bl SErrorInterrupt + + RestoreRegister + + eret + + +.align 8 + + +.end \ No newline at end of file diff --git a/third-party/freertos/portable/GCC/ft_platform/aarch64/vectors_g.c b/third-party/freertos/portable/GCC/ft_platform/aarch64/vectors_g.c new file mode 100644 index 00000000..276897eb --- /dev/null +++ b/third-party/freertos/portable/GCC/ft_platform/aarch64/vectors_g.c @@ -0,0 +1,25 @@ +/* + * @ : Copyright (c) 2021 Phytium Information Technology, Inc. + * + * SPDX-License-Identifier: Apache-2.0. + * + * @Date: 2021-12-15 11:26:01 + * @LastEditTime: 2021-12-15 11:52:25 + * @Description:  This files is for + * + * @Modify History: + * Ver   Who        Date         Changes + * ----- ------     --------    -------------------------------------- + */ + + + + + + +#include "ft_types.h" + + +volatile u8 fpu_context[528] ; +volatile u8 *fpu_context_base ; +volatile u8 fpu_status ; diff --git a/third-party/freertos/portable/GCC/ft_platform_o/aarch32/FreeRTOSConfig.h b/third-party/freertos/portable/GCC/ft_platform_o/aarch32/FreeRTOSConfig.h new file mode 100644 index 00000000..7d013424 --- /dev/null +++ b/third-party/freertos/portable/GCC/ft_platform_o/aarch32/FreeRTOSConfig.h @@ -0,0 +1,250 @@ +/* + * FreeRTOS V202011.00 + * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * http://www.FreeRTOS.org + * http://aws.amazon.com/freertos + * + * 1 tab == 4 spaces! + */ + +#ifndef FREERTOS_CONFIG_H +#define FREERTOS_CONFIG_H + +/*----------------------------------------------------------- + * Application specific definitions. + * + * These definitions should be adjusted for your particular hardware and + * application requirements. + * + * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE + * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. + * + * See http://www.freertos.org/a00110.html + *----------------------------------------------------------*/ + +/* + * The FreeRTOS Cortex-A port implements a full interrupt nesting model. + * + * Interrupts that are assigned a priority at or below + * configMAX_API_CALL_INTERRUPT_PRIORITY (which counter-intuitively in the ARM + * generic interrupt controller [GIC] means a priority that has a numerical + * value above configMAX_API_CALL_INTERRUPT_PRIORITY) can call FreeRTOS safe API + * functions and will nest. + * + * Interrupts that are assigned a priority above + * configMAX_API_CALL_INTERRUPT_PRIORITY (which in the GIC means a numerical + * value below configMAX_API_CALL_INTERRUPT_PRIORITY) cannot call any FreeRTOS + * API functions, will nest, and will not be masked by FreeRTOS critical + * sections (although it is necessary for interrupts to be globally disabled + * extremely briefly as the interrupt mask is updated in the GIC). + * + * FreeRTOS functions that can be called from an interrupt are those that end in + * "FromISR". FreeRTOS maintains a separate interrupt safe API to enable + * interrupt entry to be shorter, faster, simpler and smaller. + * + */ + +/* 在不安全group1 中 ,0x8 ~0xb 不可以使用安全api(优先级越低越高)*/ +#define configMAX_API_CALL_INTERRUPT_PRIORITY 0xb +/* 在不安全group1 中,16 is steps ,3 是其中等级*/ +#define configKERNEL_INTERRUPT_PRIORITY ((0x8 << 4) + 3 * 16) + + +#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 //Method to select the next task +#define configUSE_TICKLESS_IDLE 0 //disable tickless mode +#define configTICK_RATE_HZ ((TickType_t)1000) //system timer rate 10ms +#define configUSE_PREEMPTION 1 //preemption task +#define configUSE_IDLE_HOOK 1 +#define configUSE_TICK_HOOK 1 +#define configMAX_PRIORITIES (7) +#define configMINIMAL_STACK_SIZE ((unsigned short)1024) //min task stack size 100*4 bytes +#define configTOTAL_HEAP_SIZE (4096 * 1024) //total heap size +#define configMAX_TASK_NAME_LEN (20) +#define configUSE_TRACE_FACILITY 1 //启用可视化跟踪调试 +/* 与宏 configUSE_TRACE_FACILITY 同时为 1 时会编译下面 3 个函数 +* prvWriteNameToBuffer() +* vTaskList(), +* vTaskGetRunTimeStats() +*/ +#define configUSE_16_BIT_TICKS 0 //use 32 bit ticktype +#define configIDLE_SHOULD_YIELD 1 //idle task would not yield for task with same priority +#define configUSE_MUTEXES 1 +#define configQUEUE_REGISTRY_SIZE 8 //max queue and semp member +#define configCHECK_FOR_STACK_OVERFLOW 0 +#define configUSE_RECURSIVE_MUTEXES 1 +#define configUSE_MALLOC_FAILED_HOOK 1 +#define configUSE_APPLICATION_TASK_TAG 0 +#define configUSE_COUNTING_SEMAPHORES 1 +#define configUSE_QUEUE_SETS 1 +#define configSUPPORT_STATIC_ALLOCATION 1 //use dynamic memory allocation +#define configSUPPORT_DYNAMIC_ALLOCATION 1 + +/* Include the query-heap CLI command to query the free heap space. */ +#define configINCLUDE_QUERY_HEAP_COMMAND 1 + +/* Co-routine definitions. */ +#define configUSE_CO_ROUTINES 0 //disable co-routines +#define configMAX_CO_ROUTINE_PRIORITIES (2) + +/* Software timer definitions. */ +#define configUSE_TIMERS 1 //use software timer +#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 1) +#define configTIMER_QUEUE_LENGTH 5 +#define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE * 2) + +/* If configUSE_TASK_FPU_SUPPORT is set to 1 (or undefined) then each task will +be created without an FPU context, and a task must call vTaskUsesFPU() before +making use of any FPU registers. If configUSE_TASK_FPU_SUPPORT is set to 2 then +tasks are created with an FPU context by default, and calling vTaskUsesFPU() has +no effect. */ +#define configUSE_TASK_FPU_SUPPORT 1 + +/* Set the following definitions to 1 to include the API function, or zero +to exclude the API function. */ +#define INCLUDE_vTaskPrioritySet 1 +#define INCLUDE_uxTaskPriorityGet 1 +#define INCLUDE_vTaskDelete 1 +#define INCLUDE_vTaskCleanUpResources 1 +#define INCLUDE_vTaskSuspend 1 +#define INCLUDE_vTaskDelayUntil 1 +#define INCLUDE_vTaskDelay 1 +#define INCLUDE_xTimerPendFunctionCall 1 +#define INCLUDE_eTaskGetState 1 +#define INCLUDE_xTaskAbortDelay 1 +#define INCLUDE_xTaskGetTaskHandle 1 +#define INCLUDE_xTaskGetHandle 1 + +#define INCLUDE_xSemaphoreGetMutexHolder 1 +#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 5 +#define INCLUDE_xTaskGetIdleTaskHandle 1 + +/* This demo makes use of one or more example stats formatting functions. These +format the raw data provided by the uxTaskGetSystemState() function in to human +readable ASCII form. See the notes in the implementation of vTaskList() within +FreeRTOS/Source/tasks.c for limitations. */ +#define configUSE_STATS_FORMATTING_FUNCTIONS 1 + +/* Run time stats are not generated. portCONFIGURE_TIMER_FOR_RUN_TIME_STATS and +portGET_RUN_TIME_COUNTER_VALUE must be defined if configGENERATE_RUN_TIME_STATS +is set to 1. */ +#define configGENERATE_RUN_TIME_STATS 1 //启用运行时间统计功能 +#ifndef __ASSEMBLER__ // skip when preprocess asm +extern volatile unsigned int gCpuRuntime; +#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() (gCpuRuntime = 0ul) +#define portGET_RUN_TIME_COUNTER_VALUE() gCpuRuntime +#endif + +/* The size of the global output buffer that is available for use when there +are multiple command interpreters running at once (for example, one on a UART +and one on TCP/IP). This is done to prevent an output buffer being defined by +each implementation - which would waste RAM. In this case, there is only one +command interpreter running. */ +#define configCOMMAND_INT_MAX_OUTPUT_SIZE 2096 + +/* Normal assert() semantics without relying on the provision of an assert.h +header file. */ + +#define configASSERT(x) \ + do \ + { \ + void vMainAssertCalled(const char *pcFileName, uint32_t ulLineNumber);\ + if ((x) == 0) \ + { \ + vMainAssertCalled(__FILE__, __LINE__);\ + } \ + } while (0); + + +/* If configTASK_RETURN_ADDRESS is not defined then a task that attempts to +return from its implementing function will end up in a "task exit error" +function - which contains a call to configASSERT(). However this can give GCC +some problems when it tries to unwind the stack, as the exit error function has +nothing to return to. To avoid this define configTASK_RETURN_ADDRESS to 0. */ +#define configTASK_RETURN_ADDRESS NULL + +/****** Hardware specific settings. *******************************************/ + +/* + * The application must provide a function that configures a peripheral to + * create the FreeRTOS tick interrupt, then define configSETUP_TICK_INTERRUPT() + * in FreeRTOSConfig.h to call the function. FreeRTOS_Tick_Handler() must + * be installed as the peripheral's interrupt handler. + */ + + +#define configSETUP_TICK_INTERRUPT() \ + do \ + { \ + void vConfigureTickInterrupt(void);\ + vConfigureTickInterrupt(); \ + } while (0) + + +#define configCLEAR_TICK_INTERRUPT() \ + do \ + { \ + void vClearTickInterrupt(void);\ + vClearTickInterrupt(); \ + }while (0) + +#define FreeRTOS_IRQ_Handler IRQ_Handler +#define FreeRTOS_SWI_Handler SWI_Handler + +#define configINTERRUPT_CONTROLLER_BASE_ADDRESS (0x71800000) +#define configINTERRUPT_CONTROLLER_CPU_INTERFACE_OFFSET (0x2000UL) +#define configUNIQUE_INTERRUPT_PRIORITIES 16 + +/****** Network configuration settings - only used when the lwIP example is +built. See the page that documents this demo on the http://www.FreeRTOS.org +website for more information. ***********************************************/ + +/* The priority for the task that unblocked by the MAC interrupt to process +received packets. */ +#define configMAC_INPUT_TASK_PRIORITY (configMAX_PRIORITIES - 1) + +/* The priority of the task that runs the lwIP stack. */ +#define configLWIP_TASK_PRIORITY (configMAX_PRIORITIES - 2) + +/* The priority of the task that uses lwIP sockets to provide a simple command +line interface. */ +#define configCLI_TASK_PRIORITY (tskIDLE_PRIORITY) + +/* MAC address configuration. */ +#define configMAC_ADDR0 0x00 +#define configMAC_ADDR1 0x13 +#define configMAC_ADDR2 0x14 +#define configMAC_ADDR3 0x15 +#define configMAC_ADDR4 0x15 +#define configMAC_ADDR5 0x16 + +/* IP address configuration. */ +#define configIP_ADDR0 172 +#define configIP_ADDR1 25 +#define configIP_ADDR2 218 +#define configIP_ADDR3 200 + +/* Netmask configuration. */ +#define configNET_MASK0 255 +#define configNET_MASK1 255 +#define configNET_MASK2 255 +#define configNET_MASK3 0 + +#endif /* FREERTOS_CONFIG_H */ diff --git a/third-party/freertos/portable/GCC/ft_platform_o/aarch32/port.c b/third-party/freertos/portable/GCC/ft_platform_o/aarch32/port.c new file mode 100644 index 00000000..74582106 --- /dev/null +++ b/third-party/freertos/portable/GCC/ft_platform_o/aarch32/port.c @@ -0,0 +1,554 @@ +/* + * FreeRTOS Kernel V10.4.2 + * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + * 1 tab == 4 spaces! + */ + +/* Standard includes. */ +#include +#include +#include "aarch32.h" + +/* Scheduler includes. */ +#include "FreeRTOS.h" +#include "task.h" + +#ifndef configINTERRUPT_CONTROLLER_BASE_ADDRESS +#error configINTERRUPT_CONTROLLER_BASE_ADDRESS must be defined. See https://www.FreeRTOS.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html +#endif + +#ifndef configINTERRUPT_CONTROLLER_CPU_INTERFACE_OFFSET +#error configINTERRUPT_CONTROLLER_CPU_INTERFACE_OFFSET must be defined. See https://www.FreeRTOS.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html +#endif + +#ifndef configUNIQUE_INTERRUPT_PRIORITIES +#error configUNIQUE_INTERRUPT_PRIORITIES must be defined. See https://www.FreeRTOS.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html +#endif + +#ifndef configSETUP_TICK_INTERRUPT +#error configSETUP_TICK_INTERRUPT() must be defined. See https://www.FreeRTOS.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html +#endif /* configSETUP_TICK_INTERRUPT */ + +#ifndef configMAX_API_CALL_INTERRUPT_PRIORITY +#error configMAX_API_CALL_INTERRUPT_PRIORITY must be defined. See https://www.FreeRTOS.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html +#endif + +#if configMAX_API_CALL_INTERRUPT_PRIORITY == 0 +#error configMAX_API_CALL_INTERRUPT_PRIORITY must not be set to 0 +#endif + +#if configMAX_API_CALL_INTERRUPT_PRIORITY > configUNIQUE_INTERRUPT_PRIORITIES +#error configMAX_API_CALL_INTERRUPT_PRIORITY must be less than or equal to configUNIQUE_INTERRUPT_PRIORITIES as the lower the numeric priority value the higher the logical interrupt priority +#endif + +#if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1 +/* Check the configuration. */ +#if (configMAX_PRIORITIES > 32) +#error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 difference priorities as tasks that share a priority will time slice. +#endif +#endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */ + +/* In case security extensions are implemented. */ +#if configMAX_API_CALL_INTERRUPT_PRIORITY <= (configUNIQUE_INTERRUPT_PRIORITIES / 2) +#error configMAX_API_CALL_INTERRUPT_PRIORITY must be greater than ( configUNIQUE_INTERRUPT_PRIORITIES / 2 ) +#endif + +/* Some vendor specific files default configCLEAR_TICK_INTERRUPT() in +portmacro.h. */ +#ifndef configCLEAR_TICK_INTERRUPT +#define configCLEAR_TICK_INTERRUPT() +#endif + +/* A critical section is exited when the critical section nesting count reaches +this value. */ +#define portNO_CRITICAL_NESTING ((uint32_t)0) + +/* In all GICs 255 can be written to the priority mask register to unmask all +(but the lowest) interrupt priority. */ +#define portUNMASK_VALUE (0xF0UL) + +/* Tasks are not created with a floating point context, but can be given a +floating point context after they have been created. A variable is stored as +part of the tasks context that holds portNO_FLOATING_POINT_CONTEXT if the task +does not have an FPU context, or any other value if the task does have an FPU +context. */ +#define portNO_FLOATING_POINT_CONTEXT ((StackType_t)0) + +/* Constants required to setup the initial task context. */ +#define portINITIAL_SPSR ((StackType_t)0x1f) /* System mode, ARM mode, IRQ enabled FIQ enabled. */ +#define portTHUMB_MODE_BIT ((StackType_t)0x20) +#define portINTERRUPT_ENABLE_BIT (0x80UL) +#define portTHUMB_MODE_ADDRESS (0x01UL) + +/* Used by portASSERT_IF_INTERRUPT_PRIORITY_INVALID() when ensuring the binary +point is zero. */ +#define portBINARY_POINT_BITS ((uint8_t)0x03) + +/* Masks all bits in the APSR other than the mode bits. */ +#define portAPSR_MODE_BITS_MASK (0x1F) + +/* The value of the mode bits in the APSR when the CPU is executing in user +mode. */ +#define portAPSR_USER_MODE (0x10) + +/* The critical section macros only mask interrupts up to an application +determined priority level. Sometimes it is necessary to turn interrupt off in +the CPU itself before modifying certain hardware registers. */ +#define portCPU_IRQ_DISABLE() \ + __asm volatile("CPSID i" :: \ + : "memory"); \ + __asm volatile("DSB"); \ + __asm volatile("ISB"); + +#define portCPU_IRQ_ENABLE() \ + __asm volatile("CPSIE i" :: \ + : "memory"); \ + __asm volatile("DSB"); \ + __asm volatile("ISB"); + +/* Macro to unmask all interrupt priorities. */ +#define portCLEAR_INTERRUPT_MASK() \ + { \ + portCPU_IRQ_DISABLE(); \ + sys_icc_pmr_set(portUNMASK_VALUE); \ + __asm volatile("DSB \n" \ + "ISB \n"); \ + portCPU_IRQ_ENABLE(); \ + } + +/* Hardware specifics used when sanity checking the configuration. */ +#define portINTERRUPT_PRIORITY_REGISTER_OFFSET (0x400UL + 32UL) // +#define portMAX_8_BIT_VALUE ((uint8_t)0xff) +#define portBIT_0_SET ((uint8_t)0x01) + +/* Let the user override the pre-loading of the initial LR with the address of +prvTaskExitError() in case it messes up unwinding of the stack in the +debugger. */ +#ifdef configTASK_RETURN_ADDRESS +#define portTASK_RETURN_ADDRESS configTASK_RETURN_ADDRESS +#else +#define portTASK_RETURN_ADDRESS prvTaskExitError +#endif + +/* The space on the stack required to hold the FPU registers. This is 32 64-bit +registers, plus a 32-bit status register. */ +#define portFPU_REGISTER_WORDS ((32 * 2) + 1) + +/*-----------------------------------------------------------*/ + +/* + * Starts the first task executing. This function is necessarily written in + * assembly code so is implemented in portASM.s. + */ +extern void vPortRestoreTaskContext(void); + +/* + * Used to catch tasks that attempt to return from their implementing function. + */ +static void prvTaskExitError(void); + +/* + * If the application provides an implementation of vApplicationIRQHandler(), + * then it will get called directly without saving the FPU registers on + * interrupt entry, and this weak implementation of + * vApplicationFPUSafeIRQHandler() is just provided to remove linkage errors - + * it should never actually get called so its implementation contains a + * call to configASSERT() that will always fail. + * + * If the application provides its own implementation of + * vApplicationFPUSafeIRQHandler() then the implementation of + * vApplicationIRQHandler() provided in portASM.S will save the FPU registers + * before calling it. + * + * Therefore, if the application writer wants FPU registers to be saved on + * interrupt entry their IRQ handler must be called + * vApplicationFPUSafeIRQHandler(), and if the application writer does not want + * FPU registers to be saved on interrupt entry their IRQ handler must be + * called vApplicationIRQHandler(). + */ +void vApplicationFPUSafeIRQHandler(uint32_t ulICCIAR) __attribute__((weak)); + +/*-----------------------------------------------------------*/ + +/* A variable is used to keep track of the critical section nesting. This +variable has to be stored as part of the task context and must be initialised to +a non zero value to ensure interrupts don't inadvertently become unmasked before +the scheduler starts. As it is stored as part of the task context it will +automatically be set to 0 when the first task is started. */ +volatile uint32_t ulCriticalNesting = 9999UL; + +/* Saved as part of the task context. If ulPortTaskHasFPUContext is non-zero then +a floating point context must be saved and restored for the task. */ +volatile uint32_t ulPortTaskHasFPUContext = pdFALSE; + +/* Set to 1 to pend a context switch from an ISR. */ +volatile uint32_t ulPortYieldRequired = pdFALSE; + +/* Counts the interrupt nesting depth. A context switch is only performed if +if the nesting depth is 0. */ +volatile uint32_t ulPortInterruptNesting = 0UL; + +/* Used in the asm file. */ +// __attribute__((used)) const uint32_t ulICCIAR = portICCIAR_INTERRUPT_ACKNOWLEDGE_REGISTER_ADDRESS; +// __attribute__((used)) const uint32_t ulICCEOIR = portICCEOIR_END_OF_INTERRUPT_REGISTER_ADDRESS; +// __attribute__((used)) const uint32_t ulICCPMR = portICCPMR_PRIORITY_MASK_REGISTER_ADDRESS; +__attribute__((used)) const uint32_t ulMaxAPIPriorityMask = (configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT); + +/*-----------------------------------------------------------*/ + +/* + * See header file for description. + */ +StackType_t *pxPortInitialiseStack(StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters) +{ + /* Setup the initial stack of the task. The stack is set exactly as + expected by the portRESTORE_CONTEXT() macro. + + The fist real value on the stack is the status register, which is set for + system mode, with interrupts enabled. A few NULLs are added first to ensure + GDB does not try decoding a non-existent return address. */ + *pxTopOfStack = (StackType_t)NULL; + pxTopOfStack--; + *pxTopOfStack = (StackType_t)NULL; + pxTopOfStack--; + *pxTopOfStack = (StackType_t)NULL; + pxTopOfStack--; + *pxTopOfStack = (StackType_t)portINITIAL_SPSR; + + if (((uint32_t)pxCode & portTHUMB_MODE_ADDRESS) != 0x00UL) + { + /* The task will start in THUMB mode. */ + *pxTopOfStack |= portTHUMB_MODE_BIT; + } + + pxTopOfStack--; + + /* Next the return address, which in this case is the start of the task. */ + *pxTopOfStack = (StackType_t)pxCode; + pxTopOfStack--; + + /* Next all the registers other than the stack pointer. */ + *pxTopOfStack = (StackType_t)portTASK_RETURN_ADDRESS; /* R14 */ + pxTopOfStack--; + *pxTopOfStack = (StackType_t)0x12121212; /* R12 */ + pxTopOfStack--; + *pxTopOfStack = (StackType_t)0x11111111; /* R11 */ + pxTopOfStack--; + *pxTopOfStack = (StackType_t)0x10101010; /* R10 */ + pxTopOfStack--; + *pxTopOfStack = (StackType_t)0x09090909; /* R9 */ + pxTopOfStack--; + *pxTopOfStack = (StackType_t)0x08080808; /* R8 */ + pxTopOfStack--; + *pxTopOfStack = (StackType_t)0x07070707; /* R7 */ + pxTopOfStack--; + *pxTopOfStack = (StackType_t)0x06060606; /* R6 */ + pxTopOfStack--; + *pxTopOfStack = (StackType_t)0x05050505; /* R5 */ + pxTopOfStack--; + *pxTopOfStack = (StackType_t)0x04040404; /* R4 */ + pxTopOfStack--; + *pxTopOfStack = (StackType_t)0x03030303; /* R3 */ + pxTopOfStack--; + *pxTopOfStack = (StackType_t)0x02020202; /* R2 */ + pxTopOfStack--; + *pxTopOfStack = (StackType_t)0x01010101; /* R1 */ + pxTopOfStack--; + *pxTopOfStack = (StackType_t)pvParameters; /* R0 */ + pxTopOfStack--; + + /* The task will start with a critical nesting count of 0 as interrupts are + enabled. */ + *pxTopOfStack = portNO_CRITICAL_NESTING; + +#if (configUSE_TASK_FPU_SUPPORT == 1) + { + /* The task will start without a floating point context. A task that + uses the floating point hardware must call vPortTaskUsesFPU() before + executing any floating point instructions. */ + pxTopOfStack--; + *pxTopOfStack = portNO_FLOATING_POINT_CONTEXT; + } +#elif (configUSE_TASK_FPU_SUPPORT == 2) + { + /* The task will start with a floating point context. Leave enough + space for the registers - and ensure they are initialised to 0. */ + pxTopOfStack -= portFPU_REGISTER_WORDS; + memset(pxTopOfStack, 0x00, portFPU_REGISTER_WORDS * sizeof(StackType_t)); + + pxTopOfStack--; + *pxTopOfStack = pdTRUE; + ulPortTaskHasFPUContext = pdTRUE; + } +#else + { +#error Invalid configUSE_TASK_FPU_SUPPORT setting - configUSE_TASK_FPU_SUPPORT must be set to 1, 2, or left undefined. + } +#endif + + return pxTopOfStack; +} +/*-----------------------------------------------------------*/ + +static void prvTaskExitError(void) +{ + /* A function that implements a task must not exit or attempt to return to + its caller as there is nothing to return to. If a task wants to exit it + should instead call vTaskDelete( NULL ). + + Artificially force an assert() to be triggered if configASSERT() is + defined, then stop here so application writers can catch the error. */ + configASSERT(ulPortInterruptNesting == ~0UL); + portDISABLE_INTERRUPTS(); + for (;;) + ; +} +/*-----------------------------------------------------------*/ + +BaseType_t xPortStartScheduler(void) +{ + uint32_t ulAPSR; + + /* Only continue if the CPU is not in User mode. The CPU must be in a + Privileged mode for the scheduler to start. */ + __asm volatile("MRS %0, APSR" + : "=r"(ulAPSR)::"memory"); + + ulAPSR &= portAPSR_MODE_BITS_MASK; + + configASSERT(ulAPSR != portAPSR_USER_MODE); + + if (ulAPSR != portAPSR_USER_MODE) + { + /* Only continue if the binary point value is set to its lowest possible + setting. See the comments in vPortValidateInterruptPriority() below for + more information. */ + + configASSERT((sys_icc_bpr_get() & portBINARY_POINT_BITS) <= portMAX_BINARY_POINT_VALUE); + + if ((sys_icc_bpr_get() & portBINARY_POINT_BITS) <= portMAX_BINARY_POINT_VALUE) + { + /* Interrupts are turned off in the CPU itself to ensure tick does + not execute while the scheduler is being started. Interrupts are + automatically turned back on in the CPU when the first task starts + executing. */ + portCPU_IRQ_DISABLE(); + + /* Start the timer that generates the tick ISR. */ + configSETUP_TICK_INTERRUPT(); + + /* Start the first task executing. */ + vPortRestoreTaskContext(); + } + } + + /* Will only get here if vTaskStartScheduler() was called with the CPU in + a non-privileged mode or the binary point register was not set to its lowest + possible value. prvTaskExitError() is referenced to prevent a compiler + warning about it being defined but not referenced in the case that the user + defines their own exit address. */ + (void)prvTaskExitError; + return 0; +} +/*-----------------------------------------------------------*/ + +void vPortEndScheduler(void) +{ + /* Not implemented in ports where there is nothing to return to. + Artificially force an assert. */ + configASSERT(ulCriticalNesting == 1000UL); +} +/*-----------------------------------------------------------*/ + +void vPortEnterCritical(void) +{ + /* Mask interrupts up to the max syscall interrupt priority. */ + ulPortSetInterruptMask(); + + /* Now interrupts are disabled ulCriticalNesting can be accessed + directly. Increment ulCriticalNesting to keep a count of how many times + portENTER_CRITICAL() has been called. */ + ulCriticalNesting++; + + /* This is not the interrupt safe version of the enter critical function so + assert() if it is being called from an interrupt context. Only API + functions that end in "FromISR" can be used in an interrupt. Only assert if + the critical nesting count is 1 to protect against recursive calls if the + assert function also uses a critical section. */ + if (ulCriticalNesting == 1) + { + configASSERT(ulPortInterruptNesting == 0); + } +} +/*-----------------------------------------------------------*/ + +void vPortExitCritical(void) +{ + if (ulCriticalNesting > portNO_CRITICAL_NESTING) + { + /* Decrement the nesting count as the critical section is being + exited. */ + ulCriticalNesting--; + + /* If the nesting level has reached zero then all interrupt + priorities must be re-enabled. */ + if (ulCriticalNesting == portNO_CRITICAL_NESTING) + { + /* Critical nesting has reached zero so all interrupt priorities + should be unmasked. */ + portCLEAR_INTERRUPT_MASK(); + } + } +} +/*-----------------------------------------------------------*/ + +void FreeRTOS_Tick_Handler(void) +{ + /* Set interrupt mask before altering scheduler structures. The tick + handler runs at the lowest priority, so interrupts cannot already be masked, + so there is no need to save and restore the current mask value. It is + necessary to turn off interrupts in the CPU itself while the ICCPMR is being + updated. */ + portCPU_IRQ_DISABLE(); + sys_icc_pmr_set((uint32_t)(configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT)); + // portICCPMR_PRIORITY_MASK_REGISTER = (uint32_t)(configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT); + __asm volatile("dsb \n" + "isb \n" :: + : "memory"); + portCPU_IRQ_ENABLE(); + /* Increment the RTOS tick. */ + if (xTaskIncrementTick() != pdFALSE) + { + ulPortYieldRequired = pdTRUE; + } + + /* Ensure all interrupt priorities are active again. */ + portCLEAR_INTERRUPT_MASK(); + configCLEAR_TICK_INTERRUPT(); +} +/*-----------------------------------------------------------*/ + +#if (configUSE_TASK_FPU_SUPPORT != 2) + +void vPortTaskUsesFPU(void) +{ + uint32_t ulInitialFPSCR = 0; + + /* A task is registering the fact that it needs an FPU context. Set the + FPU flag (which is saved as part of the task context). */ + ulPortTaskHasFPUContext = pdTRUE; + + /* Initialise the floating point status register. */ + __asm volatile("FMXR FPSCR, %0" ::"r"(ulInitialFPSCR) + : "memory"); +} + +#endif /* configUSE_TASK_FPU_SUPPORT */ +/*-----------------------------------------------------------*/ + +void vPortClearInterruptMask(uint32_t ulNewMaskValue) +{ + if (ulNewMaskValue == pdFALSE) + { + portCLEAR_INTERRUPT_MASK(); + } +} +/*-----------------------------------------------------------*/ + +uint32_t ulPortSetInterruptMask(void) +{ + uint32_t ulReturn; + + /* Interrupt in the CPU must be turned off while the ICCPMR is being + updated. */ + portCPU_IRQ_DISABLE(); + if (sys_icc_pmr_get() == (uint32_t)(configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT)) + { + /* Interrupts were already masked. */ + ulReturn = pdTRUE; + } + else + { + ulReturn = pdFALSE; + sys_icc_pmr_set((uint32_t)(configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT)); + // portICCPMR_PRIORITY_MASK_REGISTER = (uint32_t)(configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT); + __asm volatile("dsb \n" + "isb \n" :: + : "memory"); + } + portCPU_IRQ_ENABLE(); + + return ulReturn; +} +/*-----------------------------------------------------------*/ + +#if (configASSERT_DEFINED == 1) + +void vPortValidateInterruptPriority(void) +{ + /* The following assertion will fail if a service routine (ISR) for + an interrupt that has been assigned a priority above + configMAX_SYSCALL_INTERRUPT_PRIORITY calls an ISR safe FreeRTOS API + function. ISR safe FreeRTOS API functions must *only* be called + from interrupts that have been assigned a priority at or below + configMAX_SYSCALL_INTERRUPT_PRIORITY. + + Numerically low interrupt priority numbers represent logically high + interrupt priorities, therefore the priority of the interrupt must + be set to a value equal to or numerically *higher* than + configMAX_SYSCALL_INTERRUPT_PRIORITY. + + FreeRTOS maintains separate thread and ISR API functions to ensure + interrupt entry is as fast and simple as possible. */ + configASSERT(sys_icc_rpr_get() >= (uint32_t)(configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT)); + + /* Priority grouping: The interrupt controller (GIC) allows the bits + that define each interrupt's priority to be split between bits that + define the interrupt's pre-emption priority bits and bits that define + the interrupt's sub-priority. For simplicity all bits must be defined + to be pre-emption priority bits. The following assertion will fail if + this is not the case (if some bits represent a sub-priority). + + The priority grouping is configured by the GIC's binary point register + (ICCBPR). Writting 0 to ICCBPR will ensure it is set to its lowest + possible value (which may be above 0). */ + configASSERT((sys_icc_bpr_get() & portBINARY_POINT_BITS) <= portMAX_BINARY_POINT_VALUE); +} + +#endif /* configASSERT_DEFINED */ +/*-----------------------------------------------------------*/ + +void vApplicationFPUSafeIRQHandler(uint32_t ulICCIAR) +{ + (void)ulICCIAR; + configASSERT((volatile void *)NULL); +} + +_WEAK void vApplicationTickHook(void) +{ +} + +_WEAK void vApplicationIdleHook(void) +{ +} \ No newline at end of file diff --git a/third-party/freertos/portable/GCC/ft_platform_o/aarch32/portASM.S b/third-party/freertos/portable/GCC/ft_platform_o/aarch32/portASM.S new file mode 100644 index 00000000..4cdbf8e8 --- /dev/null +++ b/third-party/freertos/portable/GCC/ft_platform_o/aarch32/portASM.S @@ -0,0 +1,339 @@ +/* + * FreeRTOS Kernel V10.4.2 + * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + * 1 tab == 4 spaces! + */ + #include "FreeRTOSConfig.h" + + .eabi_attribute Tag_ABI_align_preserved, 1 + .text + .arm + + .set SYS_MODE, 0x1f + .set SVC_MODE, 0x13 + .set IRQ_MODE, 0x12 + + /* Hardware registers. */ + + /* Variables and functions. */ + .extern ulMaxAPIPriorityMask + .extern _freertos_vector_table + .extern pxCurrentTCB + .extern vTaskSwitchContext + .extern vApplicationIRQHandler + .extern ulPortInterruptNesting + .extern ulPortTaskHasFPUContext + + .global FreeRTOS_IRQ_Handler + .global FreeRTOS_SWI_Handler + .global vPortRestoreTaskContext + + +.macro portSAVE_CONTEXT + + /* Save the LR and SPSR onto the system mode stack before switching to + system mode to save the remaining system mode registers. */ + SRSDB sp!, #SYS_MODE + CPS #SYS_MODE + PUSH {R0-R12, R14} + + /* Push the critical nesting count. */ + LDR R2, ulCriticalNestingConst + LDR R1, [R2] + PUSH {R1} + + /* Does the task have a floating point context that needs saving? If + ulPortTaskHasFPUContext is 0 then no. */ + LDR R2, ulPortTaskHasFPUContextConst + LDR R3, [R2] + CMP R3, #0 + + /* Save the floating point context, if any. */ + FMRXNE R1, FPSCR + VPUSHNE {D0-D15} + VPUSHNE {D16-D31} + PUSHNE {R1} + + + /* Save ulPortTaskHasFPUContext itself. */ + PUSH {R3} + + + /* Save the stack pointer in the TCB. */ + LDR R0, pxCurrentTCBConst + LDR R1, [R0] + STR SP, [R1] + + .endm + +; /**********************************************************************/ + +.macro portRESTORE_CONTEXT + /* Set the SP to point to the stack of the task being restored. */ + LDR R0, pxCurrentTCBConst + LDR R1, [R0] + LDR SP, [R1] + + /* Is there a floating point context to restore? If the restored + ulPortTaskHasFPUContext is zero then no. */ + LDR R0, ulPortTaskHasFPUContextConst + POP {R1} + STR R1, [R0] + CMP R1, #0 + + + /* Restore the floating point context, if any. */ + POPNE {R0} + VPOPNE {D16-D31} + VPOPNE {D0-D15} + VMSRNE FPSCR, R0 + + + /* Restore the critical section nesting depth. */ + LDR R0, ulCriticalNestingConst + POP {R1} + STR R1, [R0] + + + /* Ensure the priority mask is correct for the critical nesting depth. */ + + CMP R1, #0 + MOVEQ R4, #255 + LDRNE R4, ulMaxAPIPriorityMaskConst + LDRNE R4, [R4] + MCR P15, 0, R4, C4, C6, 0 + ISB + + + /* Restore all system mode registers other than the SP (which is already + being used). */ + POP {R0-R12, R14} + + /* Return to the task code, loading CPSR on the way. */ + RFEIA sp! + + .endm + + + + +/****************************************************************************** + * SVC handler is used to start the scheduler. + *****************************************************************************/ +.align 4 +.type FreeRTOS_SWI_Handler, %function +FreeRTOS_SWI_Handler: + /* Save the context of the current task and select a new task to run. */ + portSAVE_CONTEXT + LDR R0, vTaskSwitchContextConst + BLX R0 + portRESTORE_CONTEXT + + +/****************************************************************************** + * vPortRestoreTaskContext is used to start the scheduler. + *****************************************************************************/ +.type vPortRestoreTaskContext, %function +vPortRestoreTaskContext: + /* Switch to system mode. */ + CPS #SYS_MODE + portRESTORE_CONTEXT + +.align 4 +.type FreeRTOS_IRQ_Handler, %function +FreeRTOS_IRQ_Handler: + /* Return to the interrupted instruction. */ + SUB lr, lr, #4 + + /* Push the return address and SPSR. */ + PUSH {lr} + MRS lr, SPSR + PUSH {lr} + + /* Change to supervisor mode to allow reentry. */ + CPS #SVC_MODE + + /* Push used registers. */ + PUSH {r0-r4, r12} + + /* Increment nesting count. r3 holds the address of ulPortInterruptNesting + for future use. r1 holds the original ulPortInterruptNesting value for + future use. */ + LDR r3, ulPortInterruptNestingConst + LDR r1, [r3] + ADD r4, r1, #1 + STR r4, [r3] + + /* Read value from the interrupt acknowledge register, which is stored in r0 + for future parameter and interrupt clearing use. */ + + mrc p15, 0, r0, c12, c12, 0 + isb + + /* Ensure bit 2 of the stack pointer is clear. r2 holds the bit 2 value for + future use. _RB_ Does this ever actually need to be done provided the start + of the stack is 8-byte aligned? */ + MOV r2, sp + AND r2, r2, #4 + SUB sp, sp, r2 + + /* Call the interrupt handler. r4 pushed to maintain alignment. */ + PUSH {r0-r4, lr} + LDR r1, vApplicationIRQHandlerConst + BLX r1 + POP {r0-r4, lr} + ADD sp, sp, r2 + + CPSID i + DSB + ISB + + /* Write the value read from ICCIAR to ICCEOIR.*/ + + mcr p15, 0, r0, c12, c12, 1 + isb + + /* Restore the old nesting count. */ + STR r1, [r3] + + /* A context switch is never performed if the nesting count is not 0. */ + CMP r1, #0 + BNE exit_without_switch + + /* Did the interrupt request a context switch? r1 holds the address of + ulPortYieldRequired and r0 the value of ulPortYieldRequired for future + use. */ + LDR r1, =ulPortYieldRequired + LDR r0, [r1] + CMP r0, #0 + BNE switch_before_exit + +exit_without_switch: + /* No context switch. Restore used registers, LR_irq and SPSR before + returning. */ + POP {r0-r4, r12} + CPS #IRQ_MODE + POP {LR} + MSR SPSR_cxsf, LR + POP {LR} + MOVS PC, LR + +switch_before_exit: + /* A context swtich is to be performed. Clear the context switch pending + flag. */ + MOV r0, #0 + STR r0, [r1] + + /* Restore used registers, LR-irq and SPSR before saving the context + to the task stack. */ + POP {r0-r4, r12} + CPS #IRQ_MODE + POP {LR} + MSR SPSR_cxsf, LR + POP {LR} + portSAVE_CONTEXT + + /* Call the function that selects the new task to execute. + vTaskSwitchContext() if vTaskSwitchContext() uses LDRD or STRD + instructions, or 8 byte aligned stack allocated data. LR does not need + saving as a new LR will be loaded by portRESTORE_CONTEXT anyway. */ + LDR R0, vTaskSwitchContextConst + BLX R0 + + /* Restore the context of, and branch to, the task selected to execute + next. */ + portRESTORE_CONTEXT + +/****************************************************************************** + * If the application provides an implementation of vApplicationIRQHandler(), + * then it will get called directly without saving the FPU registers on + * interrupt entry, and this weak implementation of + * vApplicationIRQHandler() will not get called. + * + * If the application provides its own implementation of + * vApplicationFPUSafeIRQHandler() then this implementation of + * vApplicationIRQHandler() will be called, save the FPU registers, and then + * call vApplicationFPUSafeIRQHandler(). + * + * Therefore, if the application writer wants FPU registers to be saved on + * interrupt entry their IRQ handler must be called + * vApplicationFPUSafeIRQHandler(), and if the application writer does not want + * FPU registers to be saved on interrupt entry their IRQ handler must be + * called vApplicationIRQHandler(). + *****************************************************************************/ + +.align 4 +.weak vApplicationIRQHandler +.type vApplicationIRQHandler, %function +vApplicationIRQHandler: + PUSH {LR} + FMRX R1, FPSCR + VPUSH {D0-D15} + VPUSH {D16-D31} + PUSH {R1} + + LDR r1, vApplicationFPUSafeIRQHandlerConst + BLX r1 + + POP {R0} + VPOP {D16-D31} + VPOP {D0-D15} + VMSR FPSCR, R0 + + POP {PC} + +/****************************************************************************** + * If the application provides an implementation of vApplicationIRQHandler(), + * then it will get called directly without saving the FPU registers on + * interrupt entry, and this weak implementation of + * vApplicationIRQHandler() will not get called. + * + * If the application provides its own implementation of + * vApplicationFPUSafeIRQHandler() then this implementation of + * vApplicationIRQHandler() will be called, save the FPU registers, and then + * call vApplicationFPUSafeIRQHandler(). + * + * Therefore, if the application writer wants FPU registers to be saved on + * interrupt entry their IRQ handler must be called + * vApplicationFPUSafeIRQHandler(), and if the application writer does not want + * FPU registers to be saved on interrupt entry their IRQ handler must be + * called vApplicationIRQHandler(). + *****************************************************************************/ + + +pxCurrentTCBConst: .word pxCurrentTCB +ulCriticalNestingConst: .word ulCriticalNesting +ulPortTaskHasFPUContextConst: .word ulPortTaskHasFPUContext +ulMaxAPIPriorityMaskConst: .word ulMaxAPIPriorityMask +vTaskSwitchContextConst: .word vTaskSwitchContext +vApplicationIRQHandlerConst: .word vApplicationIRQHandler +ulPortInterruptNestingConst: .word ulPortInterruptNesting +vApplicationFPUSafeIRQHandlerConst: .word vApplicationFPUSafeIRQHandler + +.end + + + + + diff --git a/third-party/freertos/portable/GCC/ft_platform_o/aarch32/portmacro.h b/third-party/freertos/portable/GCC/ft_platform_o/aarch32/portmacro.h new file mode 100644 index 00000000..bbf98f73 --- /dev/null +++ b/third-party/freertos/portable/GCC/ft_platform_o/aarch32/portmacro.h @@ -0,0 +1,201 @@ +/* + * FreeRTOS Kernel V10.4.2 + * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * https://www.FreeRTOS.org + * https://github.com/FreeRTOS + * + * 1 tab == 4 spaces! + */ + +#ifndef PORTMACRO_H +#define PORTMACRO_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +/*----------------------------------------------------------- + * Port specific definitions. + * + * The settings in this file configure FreeRTOS correctly for the given hardware + * and compiler. + * + * These settings should not be altered. + *----------------------------------------------------------- + */ + +/* Type definitions. */ +#define portCHAR char +#define portFLOAT float +#define portDOUBLE double +#define portLONG long +#define portSHORT short +#define portSTACK_TYPE uint32_t +#define portBASE_TYPE long + + typedef portSTACK_TYPE StackType_t; + typedef long BaseType_t; + typedef unsigned long UBaseType_t; + + typedef uint32_t TickType_t; +#define portMAX_DELAY (TickType_t)0xffffffffUL + +/* 32-bit tick type on a 32-bit architecture, so reads of the tick count do +not need to be guarded with a critical section. */ +#define portTICK_TYPE_IS_ATOMIC 1 + +/*-----------------------------------------------------------*/ + +/* Hardware specifics. */ +#define portSTACK_GROWTH (-1) +#define portTICK_PERIOD_MS ((TickType_t)1000 / configTICK_RATE_HZ) +#define portBYTE_ALIGNMENT 32 + +/*-----------------------------------------------------------*/ + +/* Task utilities. */ + +/* Called at the end of an ISR that can cause a context switch. */ +#define portEND_SWITCHING_ISR(xSwitchRequired) \ + { \ + extern uint32_t ulPortYieldRequired; \ + \ + if (xSwitchRequired != pdFALSE) \ + { \ + ulPortYieldRequired = pdTRUE; \ + } \ + } + +#define portYIELD_FROM_ISR(x) portEND_SWITCHING_ISR(x) +#define portYIELD() __asm volatile("SWI 0" :: \ + : "memory"); + + /*----------------------------------------------------------- + * Critical section control + *----------------------------------------------------------*/ + + extern void vPortEnterCritical(void); + extern void vPortExitCritical(void); + extern uint32_t ulPortSetInterruptMask(void); + extern void vPortClearInterruptMask(uint32_t ulNewMaskValue); + extern void vPortInstallFreeRTOSVectorTable(void); + +/* These macros do not globally disable/enable interrupts. They do mask off +interrupts that have a priority below configMAX_API_CALL_INTERRUPT_PRIORITY. */ +#define portENTER_CRITICAL() vPortEnterCritical(); +#define portEXIT_CRITICAL() vPortExitCritical(); +#define portDISABLE_INTERRUPTS() ulPortSetInterruptMask() +#define portENABLE_INTERRUPTS() vPortClearInterruptMask(0) +#define portSET_INTERRUPT_MASK_FROM_ISR() ulPortSetInterruptMask() +#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vPortClearInterruptMask(x) + +/*-----------------------------------------------------------*/ + +/* Task function macros as described on the FreeRTOS.org WEB site. These are +not required for this port but included in case common demo code that uses these +macros is used. */ +#define portTASK_FUNCTION_PROTO(vFunction, pvParameters) void vFunction(void *pvParameters) +#define portTASK_FUNCTION(vFunction, pvParameters) void vFunction(void *pvParameters) + + /* Prototype of the FreeRTOS tick handler. This must be installed as the +handler for whichever peripheral is used to generate the RTOS tick. */ + void FreeRTOS_Tick_Handler(void); + +/* If configUSE_TASK_FPU_SUPPORT is set to 1 (or left undefined) then tasks are +created without an FPU context and must call vPortTaskUsesFPU() to give +themselves an FPU context before using any FPU instructions. If +configUSE_TASK_FPU_SUPPORT is set to 2 then all tasks will have an FPU context +by default. */ +#if (configUSE_TASK_FPU_SUPPORT != 2) + void vPortTaskUsesFPU(void); +#else +/* Each task has an FPU context already, so define this function away to + nothing to prevent it being called accidentally. */ +#define vPortTaskUsesFPU() +#endif +#define portTASK_USES_FLOATING_POINT() vPortTaskUsesFPU() + +#define portLOWEST_INTERRUPT_PRIORITY (((uint32_t)configUNIQUE_INTERRUPT_PRIORITIES) - 1UL) +#define portLOWEST_USABLE_INTERRUPT_PRIORITY (portLOWEST_INTERRUPT_PRIORITY - 1UL) + +/* Architecture specific optimisations. */ +#ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION +#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 +#endif + +#if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1 + +/* Store/clear the ready priorities in a bit map. */ +#define portRECORD_READY_PRIORITY(uxPriority, uxReadyPriorities) (uxReadyPriorities) |= (1UL << (uxPriority)) +#define portRESET_READY_PRIORITY(uxPriority, uxReadyPriorities) (uxReadyPriorities) &= ~(1UL << (uxPriority)) + + /*-----------------------------------------------------------*/ + +#define portGET_HIGHEST_PRIORITY(uxTopPriority, uxReadyPriorities) uxTopPriority = (31UL - (uint32_t)__builtin_clz(uxReadyPriorities)) + +#endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */ + +#ifdef configASSERT + void vPortValidateInterruptPriority(void); +#define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() vPortValidateInterruptPriority() +#endif /* configASSERT */ + +#define portNOP() __asm volatile("NOP") +#define portINLINE __inline + +#ifdef __cplusplus +} /* extern C */ +#endif + +/* The number of bits to shift for an interrupt priority is dependent on the +number of bits implemented by the interrupt controller. */ +#if configUNIQUE_INTERRUPT_PRIORITIES == 16 +#define portPRIORITY_SHIFT 4 +#define portMAX_BINARY_POINT_VALUE 3 +#elif configUNIQUE_INTERRUPT_PRIORITIES == 32 +#define portPRIORITY_SHIFT 3 +#define portMAX_BINARY_POINT_VALUE 2 +#elif configUNIQUE_INTERRUPT_PRIORITIES == 64 +#define portPRIORITY_SHIFT 2 +#define portMAX_BINARY_POINT_VALUE 1 +#elif configUNIQUE_INTERRUPT_PRIORITIES == 128 +#define portPRIORITY_SHIFT 1 +#define portMAX_BINARY_POINT_VALUE 0 +#elif configUNIQUE_INTERRUPT_PRIORITIES == 256 +#define portPRIORITY_SHIFT 0 +#define portMAX_BINARY_POINT_VALUE 0 +#else +#error Invalid configUNIQUE_INTERRUPT_PRIORITIES setting. configUNIQUE_INTERRUPT_PRIORITIES must be set to the number of unique priorities implemented by the target hardware +#endif + +/* Interrupt controller access addresses. */ +#define portICCPMR_PRIORITY_MASK_OFFSET (0x04) +#define portICCIAR_INTERRUPT_ACKNOWLEDGE_OFFSET (0x0C) +#define portICCEOIR_END_OF_INTERRUPT_OFFSET (0x10) +#define portICCBPR_BINARY_POINT_OFFSET (0x08) +#define portICCRPR_RUNNING_PRIORITY_OFFSET (0x14) + + +#define portMEMORY_BARRIER() __asm volatile("" :: \ + : "memory") + +#endif /* PORTMACRO_H */ diff --git a/third-party/freertos/portable/GCC/ft_platform_o/aarch64/FreeRTOSConfig.h b/third-party/freertos/portable/GCC/ft_platform_o/aarch64/FreeRTOSConfig.h new file mode 100644 index 00000000..07566640 --- /dev/null +++ b/third-party/freertos/portable/GCC/ft_platform_o/aarch64/FreeRTOSConfig.h @@ -0,0 +1,191 @@ +/* + * FreeRTOS Kernel V10.0.1 + * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * http://www.FreeRTOS.org + * http://aws.amazon.com/freertos + * + * 1 tab == 4 spaces! + */ + +#ifndef FREERTOS_CONFIG_H +#define FREERTOS_CONFIG_H + +#include "parameters.h" + +/*----------------------------------------------------------- + * Application specific definitions. + * + * These definitions should be adjusted for your particular hardware and + * application requirements. + * + * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE + * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. + * + * See http://www.freertos.org/a00110.html. + *----------------------------------------------------------*/ + +/* + * The FreeRTOS Cortex-A port implements a full interrupt nesting model. + * + * Interrupts that are assigned a priority at or below + * configMAX_API_CALL_INTERRUPT_PRIORITY (which counter-intuitively in the ARM + * generic interrupt controller [GIC] means a priority that has a numerical + * value above configMAX_API_CALL_INTERRUPT_PRIORITY) can call FreeRTOS safe API + * functions and will nest. + * + * Interrupts that are assigned a priority above + * configMAX_API_CALL_INTERRUPT_PRIORITY (which in the GIC means a numerical + * value below configMAX_API_CALL_INTERRUPT_PRIORITY) cannot call any FreeRTOS + * API functions, will nest, and will not be masked by FreeRTOS critical + * sections (although it is necessary for interrupts to be globally disabled + * extremely briefly as the interrupt mask is updated in the GIC). + * + * FreeRTOS functions that can be called from an interrupt are those that end in + * "FromISR". FreeRTOS maintains a separate interrupt safe API to enable + * interrupt entry to be shorter, faster, simpler and smaller. + * + * For the purpose of setting configMAX_API_CALL_INTERRUPT_PRIORITY 255 + * represents the lowest priority. + */ +/* 在不安全group1 中 ,0x8 ~0xb 不可以使用安全api(优先级越低越高)*/ +#define configMAX_API_CALL_INTERRUPT_PRIORITY 0xb +/* 在不安全group1 中,16 is steps ,3 是其中等级*/ +#define configKERNEL_INTERRUPT_PRIORITY ((0x8 << 4) + 3 * 16) + +#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 +#define configUSE_TICKLESS_IDLE 0 +#define configTICK_RATE_HZ ((TickType_t)1000) +#define configPERIPHERAL_CLOCK_HZ (33333000UL) +#define configUSE_PREEMPTION 1 +#define configUSE_IDLE_HOOK 1 +#define configUSE_TICK_HOOK 1 +#define configMAX_PRIORITIES (8) +#define configMINIMAL_STACK_SIZE ((unsigned short)1024) +#define configTOTAL_HEAP_SIZE (1024 * 1024) +#define configMAX_TASK_NAME_LEN (10) +#define configUSE_16_BIT_TICKS 0 +#define configIDLE_SHOULD_YIELD 1 +#define configUSE_MUTEXES 1 +#define configQUEUE_REGISTRY_SIZE 8 +#define configUSE_RECURSIVE_MUTEXES 1 +#define configUSE_APPLICATION_TASK_TAG 0 +#define configUSE_COUNTING_SEMAPHORES 1 +#define configUSE_QUEUE_SETS 1 + +/* This demo creates RTOS objects using both static and dynamic allocation. */ +#define configSUPPORT_STATIC_ALLOCATION 1 +#define configSUPPORT_DYNAMIC_ALLOCATION 1 /* Defaults to 1 anyway. */ + +/* Co-routine definitions. */ +#define configUSE_CO_ROUTINES 0 +#define configMAX_CO_ROUTINE_PRIORITIES (2) + +/* Software timer definitions. */ +#define configUSE_TIMERS 1 +#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 1) +#define configTIMER_QUEUE_LENGTH 5 +#define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE * 2) + +/* Set the following definitions to 1 to include the API function, or zero +to exclude the API function. */ +#define INCLUDE_vTaskPrioritySet 1 +#define INCLUDE_uxTaskPriorityGet 1 +#define INCLUDE_vTaskDelete 1 +#define INCLUDE_vTaskCleanUpResources 1 +#define INCLUDE_vTaskSuspend 1 +#define INCLUDE_vTaskDelayUntil 1 +#define INCLUDE_vTaskDelay 1 +#define INCLUDE_xTimerPendFunctionCall 1 +#define INCLUDE_eTaskGetState 1 +#define INCLUDE_xTaskAbortDelay 1 +#define INCLUDE_xTaskGetHandle 1 + +#define INCLUDE_xSemaphoreGetMutexHolder 1 +#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 5 +#define INCLUDE_xTaskGetIdleTaskHandle 1 + +/* This demo makes use of one or more example stats formatting functions. These +format the raw data provided by the uxTaskGetSystemState() function in to human +readable ASCII form. See the notes in the implementation of vTaskList() within +FreeRTOS/Source/tasks.c for limitations. */ +#define configUSE_STATS_FORMATTING_FUNCTIONS 1 + +/* Run time stats are not generated. portCONFIGURE_TIMER_FOR_RUN_TIME_STATS and +portGET_RUN_TIME_COUNTER_VALUE must be defined if configGENERATE_RUN_TIME_STATS +is set to 1. */ +#define configGENERATE_RUN_TIME_STATS 1 //启用运行时间统计功能 +extern volatile unsigned int gCpuRuntime; +#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() (gCpuRuntime = 0ul) +#define portGET_RUN_TIME_COUNTER_VALUE() gCpuRuntime + +/* The size of the global output buffer that is available for use when there +are multiple command interpreters running at once (for example, one on a UART +and one on TCP/IP). This is done to prevent an output buffer being defined by +each implementation - which would waste RAM. In this case, there is only one +command interpreter running. */ +#define configCOMMAND_INT_MAX_OUTPUT_SIZE 2096 + +/* Normal assert() semantics without relying on the provision of an assert.h +header file. */ +void vMainAssertCalled(const char *pcFileName, uint32_t ulLineNumber); +#define configASSERT(x) \ + if ((x) == 0) \ + { \ + vMainAssertCalled(__FILE__, __LINE__); \ + } + +/* If configTASK_RETURN_ADDRESS is not defined then a task that attempts to +return from its implementing function will end up in a "task exit error" +function - which contains a call to configASSERT(). However this can give GCC +some problems when it tries to unwind the stack, as the exit error function has +nothing to return to. To avoid this define configTASK_RETURN_ADDRESS to 0. */ +#define configTASK_RETURN_ADDRESS NULL + +/* Bump up the priority of recmuCONTROLLING_TASK_PRIORITY to prevent false +positive errors being reported considering the priority of other tasks in the +system. */ +#define recmuCONTROLLING_TASK_PRIORITY (configMAX_PRIORITIES - 2) + +/****** Hardware specific settings. *******************************************/ + +/* + * The application must provide a function that configures a peripheral to + * create the FreeRTOS tick interrupt, then define configSETUP_TICK_INTERRUPT() + * in FreeRTOSConfig.h to call the function. This file contains a function + * that is suitable for use on the Zynq MPU. FreeRTOS_Tick_Handler() must + * be installed as the peripheral's interrupt handler. + */ +void vConfigureTickInterrupt(void); +#define configSETUP_TICK_INTERRUPT() vConfigureTickInterrupt() + +void vClearTickInterrupt(void); +#define configCLEAR_TICK_INTERRUPT() vClearTickInterrupt() + +/* The following constant describe the hardware, and are correct for the +QEMU-Virt. */ +#define configINTERRUPT_CONTROLLER_BASE_ADDRESS (GICV3_DISTRIBUTOR_BASEADDRESS) +#define configUNIQUE_INTERRUPT_PRIORITIES 16 + +#define fabs(x) __builtin_fabs(x) + +#define configUSE_TRACE_FACILITY 1 + +#endif /* FREERTOS_CONFIG_H */ diff --git a/third-party/freertos/portable/GCC/ft_platform_o/aarch64/port.c b/third-party/freertos/portable/GCC/ft_platform_o/aarch64/port.c new file mode 100644 index 00000000..0798bcaf --- /dev/null +++ b/third-party/freertos/portable/GCC/ft_platform_o/aarch64/port.c @@ -0,0 +1,514 @@ +/* + * FreeRTOS Kernel V10.0.1 + * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * http://www.FreeRTOS.org + * http://aws.amazon.com/freertos + * + * 1 tab == 4 spaces! + */ + +/* Standard includes. */ +#include +#include +/* Scheduler includes. */ +#include "FreeRTOS.h" +#include "task.h" +#include "ft_types.h" +#include "gicv3_cpuif.h" + +#ifndef configUNIQUE_INTERRUPT_PRIORITIES +#error configUNIQUE_INTERRUPT_PRIORITIES must be defined. See http://www.freertos.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html +#endif + +#ifndef configSETUP_TICK_INTERRUPT +#error configSETUP_TICK_INTERRUPT() must be defined. See http://www.freertos.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html +#endif /* configSETUP_TICK_INTERRUPT */ + +#ifndef configMAX_API_CALL_INTERRUPT_PRIORITY +#error configMAX_API_CALL_INTERRUPT_PRIORITY must be defined. See http://www.freertos.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html +#endif + +#if configMAX_API_CALL_INTERRUPT_PRIORITY == 0 +#error configMAX_API_CALL_INTERRUPT_PRIORITY must not be set to 0 +#endif + +#if configMAX_API_CALL_INTERRUPT_PRIORITY > configUNIQUE_INTERRUPT_PRIORITIES +#error configMAX_API_CALL_INTERRUPT_PRIORITY must be less than or equal to configUNIQUE_INTERRUPT_PRIORITIES as the lower the numeric priority value the higher the logical interrupt priority +#endif + +#if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1 +/* Check the configuration. */ +#if (configMAX_PRIORITIES > 32) +#error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 difference priorities as tasks that share a priority will time slice. +#endif +#endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */ + +/* In case security extensions are implemented. */ +#if configMAX_API_CALL_INTERRUPT_PRIORITY <= (configUNIQUE_INTERRUPT_PRIORITIES / 2) +#error configMAX_API_CALL_INTERRUPT_PRIORITY must be greater than ( configUNIQUE_INTERRUPT_PRIORITIES / 2 ) +#endif + +/* Some vendor specific files default configCLEAR_TICK_INTERRUPT() in +portmacro.h. */ +#ifndef configCLEAR_TICK_INTERRUPT +#define configCLEAR_TICK_INTERRUPT() +#endif + +/* A critical section is exited when the critical section nesting count reaches +this value. */ +#define portNO_CRITICAL_NESTING ((size_t)0) + +/* In all GICs 255 can be written to the priority mask register to unmask all +(but the lowest) interrupt priority. */ +#define portUNMASK_VALUE (0xF0UL) + +/* Tasks are not created with a floating point context, but can be given a +floating point context after they have been created. A variable is stored as +part of the tasks context that holds portNO_FLOATING_POINT_CONTEXT if the task +does not have an FPU context, or any other value if the task does have an FPU +context. */ +#define portNO_FLOATING_POINT_CONTEXT ((StackType_t)0) + +/* Constants required to setup the initial task context. */ +#define portSP_ELx ((StackType_t)0x01) +#define portSP_EL0 ((StackType_t)0x00) + +#if defined(GUEST) +#define portEL1 ((StackType_t)0x04) +#define portINITIAL_PSTATE (portEL1 | portSP_EL0) +#else +#define portEL3 ((StackType_t)0x0c) +/* At the time of writing, the BSP only supports EL3. */ +#define portINITIAL_PSTATE (portEL3 | portSP_EL0) +#endif + +/* Used by portASSERT_IF_INTERRUPT_PRIORITY_INVALID() when ensuring the binary +point is zero. */ +#define portBINARY_POINT_BITS ((uint8_t)0x03) + +/* Masks all bits in the APSR other than the mode bits. */ +#define portAPSR_MODE_BITS_MASK (0x0C) + +/* The I bit in the DAIF bits. */ +#define portDAIF_I (0x80) + +/* Macro to unmask all interrupt priorities. */ +#define portCLEAR_INTERRUPT_MASK() \ + { \ + portDISABLE_INTERRUPTS(); \ + setPriorityMask(portUNMASK_VALUE); \ + __asm volatile("DSB SY \n" \ + "ISB SY \n"); \ + portENABLE_INTERRUPTS(); \ + } + +/* Hardware specifics used when sanity checking the configuration. */ +#define portINTERRUPT_PRIORITY_REGISTER_OFFSET (0x400UL + 32UL) // +#define portMAX_8_BIT_VALUE ((uint8_t)0xff) +#define portBIT_0_SET ((uint8_t)0x01) + +/*-----------------------------------------------------------*/ + +/* + * Starts the first task executing. This function is necessarily written in + * assembly code so is implemented in portASM.s. + */ +extern void vPortRestoreTaskContext(void); + +/*-----------------------------------------------------------*/ + +/* A variable is used to keep track of the critical section nesting. This +variable has to be stored as part of the task context and must be initialised to +a non zero value to ensure interrupts don't inadvertently become unmasked before +the scheduler starts. As it is stored as part of the task context it will +automatically be set to 0 when the first task is started. */ +volatile uint64_t ullCriticalNesting = 9999ULL; + +/* Saved as part of the task context. If ullPortTaskHasFPUContext is non-zero +then floating point context must be saved and restored for the task. */ +uint64_t ullPortTaskHasFPUContext = pdFALSE; + +/* Set to 1 to pend a context switch from an ISR. */ +uint64_t ullPortYieldRequired = pdFALSE; + +/* Counts the interrupt nesting depth. A context switch is only performed if +if the nesting depth is 0. */ +uint64_t ullPortInterruptNesting = pdFALSE; + +/* Used in the ASM code. */ +__attribute__((used)) const uint64_t ullMaxAPIPriorityMask = (configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT); + +/*-----------------------------------------------------------*/ + +/* + * See header file for description. + */ +StackType_t *pxPortInitialiseStack(StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters) +{ + /* Setup the initial stack of the task. The stack is set exactly as + expected by the portRESTORE_CONTEXT() macro. */ + + /* First all the general purpose registers. */ + pxTopOfStack--; + *pxTopOfStack = 0x0101010101010101ULL; /* R1 */ + pxTopOfStack--; + *pxTopOfStack = (StackType_t)pvParameters; /* R0 */ + pxTopOfStack--; + *pxTopOfStack = 0x0303030303030303ULL; /* R3 */ + pxTopOfStack--; + *pxTopOfStack = 0x0202020202020202ULL; /* R2 */ + pxTopOfStack--; + *pxTopOfStack = 0x0505050505050505ULL; /* R5 */ + pxTopOfStack--; + *pxTopOfStack = 0x0404040404040404ULL; /* R4 */ + pxTopOfStack--; + *pxTopOfStack = 0x0707070707070707ULL; /* R7 */ + pxTopOfStack--; + *pxTopOfStack = 0x0606060606060606ULL; /* R6 */ + pxTopOfStack--; + *pxTopOfStack = 0x0909090909090909ULL; /* R9 */ + pxTopOfStack--; + *pxTopOfStack = 0x0808080808080808ULL; /* R8 */ + pxTopOfStack--; + *pxTopOfStack = 0x1111111111111111ULL; /* R11 */ + pxTopOfStack--; + *pxTopOfStack = 0x1010101010101010ULL; /* R10 */ + pxTopOfStack--; + *pxTopOfStack = 0x1313131313131313ULL; /* R13 */ + pxTopOfStack--; + *pxTopOfStack = 0x1212121212121212ULL; /* R12 */ + pxTopOfStack--; + *pxTopOfStack = 0x1515151515151515ULL; /* R15 */ + pxTopOfStack--; + *pxTopOfStack = 0x1414141414141414ULL; /* R14 */ + pxTopOfStack--; + *pxTopOfStack = 0x1717171717171717ULL; /* R17 */ + pxTopOfStack--; + *pxTopOfStack = 0x1616161616161616ULL; /* R16 */ + pxTopOfStack--; + *pxTopOfStack = 0x1919191919191919ULL; /* R19 */ + pxTopOfStack--; + *pxTopOfStack = 0x1818181818181818ULL; /* R18 */ + pxTopOfStack--; + *pxTopOfStack = 0x2121212121212121ULL; /* R21 */ + pxTopOfStack--; + *pxTopOfStack = 0x2020202020202020ULL; /* R20 */ + pxTopOfStack--; + *pxTopOfStack = 0x2323232323232323ULL; /* R23 */ + pxTopOfStack--; + *pxTopOfStack = 0x2222222222222222ULL; /* R22 */ + pxTopOfStack--; + *pxTopOfStack = 0x2525252525252525ULL; /* R25 */ + pxTopOfStack--; + *pxTopOfStack = 0x2424242424242424ULL; /* R24 */ + pxTopOfStack--; + *pxTopOfStack = 0x2727272727272727ULL; /* R27 */ + pxTopOfStack--; + *pxTopOfStack = 0x2626262626262626ULL; /* R26 */ + pxTopOfStack--; + *pxTopOfStack = 0x2929292929292929ULL; /* R29 */ + pxTopOfStack--; + *pxTopOfStack = 0x2828282828282828ULL; /* R28 */ + pxTopOfStack--; + *pxTopOfStack = (StackType_t)0x00; /* XZR - has no effect, used so there are an even number of registers. */ + pxTopOfStack--; + *pxTopOfStack = (StackType_t)0x00; /* R30 - procedure call link register. */ + pxTopOfStack--; + + *pxTopOfStack = portINITIAL_PSTATE; + pxTopOfStack--; + + *pxTopOfStack = (StackType_t)pxCode; /* Exception return address. */ + pxTopOfStack--; + + /* The task will start with a critical nesting count of 0 as interrupts are + enabled. */ + *pxTopOfStack = portNO_CRITICAL_NESTING; + pxTopOfStack--; + + /* The task will start without a floating point context. A task that uses + the floating point hardware must call vPortTaskUsesFPU() before executing + any floating point instructions. */ + *pxTopOfStack = portNO_FLOATING_POINT_CONTEXT; + + return pxTopOfStack; +} +/*-----------------------------------------------------------*/ + +BaseType_t xPortStartScheduler(void) +{ + uint32_t ulAPSR; + +#if (configASSERT_DEFINED == 1) + { + volatile uint32_t ulOriginalPriority; + volatile uint8_t *const pucFirstUserPriorityRegister = (volatile uint8_t *const)(configINTERRUPT_CONTROLLER_BASE_ADDRESS + portINTERRUPT_PRIORITY_REGISTER_OFFSET); + volatile uint8_t ucMaxPriorityValue; + if(pucFirstUserPriorityRegister != 0) + { + /* Determine how many priority bits are implemented in the GIC. + Save the interrupt priority value that is about to be clobbered. */ + ulOriginalPriority = *pucFirstUserPriorityRegister; + /* Determine the number of priority bits available. First write to + all possible bits. */ + *pucFirstUserPriorityRegister = portMAX_8_BIT_VALUE; + + /* Read the value back to see how many bits stuck. */ + ucMaxPriorityValue = *pucFirstUserPriorityRegister; + + if(ucMaxPriorityValue != 0) + { + /* Shift to the least significant bits. */ + while ((ucMaxPriorityValue & portBIT_0_SET) != portBIT_0_SET) + { + ucMaxPriorityValue >>= (uint8_t)0x01; + } + /* Sanity check configUNIQUE_INTERRUPT_PRIORITIES matches the read + value. */ + configASSERT(ucMaxPriorityValue >= portLOWEST_INTERRUPT_PRIORITY); + } + + /* Restore the clobbered interrupt priority register to its original + value. */ + *pucFirstUserPriorityRegister = ulOriginalPriority; + } + + } +#endif /* conifgASSERT_DEFINED */ + + /* At the time of writing, the BSP only supports EL1. */ + __asm volatile("MRS %0, CurrentEL" + : "=r"(ulAPSR)); + ulAPSR &= portAPSR_MODE_BITS_MASK; +#if defined(GUEST) + configASSERT(ulAPSR == portEL1); + if (ulAPSR == portEL1) +#else + configASSERT(ulAPSR == portEL3); + if (ulAPSR == portEL3) +#endif + { + /* Only continue if the binary point value is set to its lowest possible + setting. See the comments in vPortValidateInterruptPriority() below for + more information. */ + // configASSERT((portICCBPR_BINARY_POINT_REGISTER & portBINARY_POINT_BITS) <= portMAX_BINARY_POINT_VALUE); + configASSERT((getBPR1() & portBINARY_POINT_BITS) <= portMAX_BINARY_POINT_VALUE); + + // if ((portICCBPR_BINARY_POINT_REGISTER & portBINARY_POINT_BITS) <= portMAX_BINARY_POINT_VALUE) + if ((getBPR1() & portBINARY_POINT_BITS) <= portMAX_BINARY_POINT_VALUE) + { + /* Interrupts are turned off in the CPU itself to ensure a tick does + not execute while the scheduler is being started. Interrupts are + automatically turned back on in the CPU when the first task starts + executing. */ + portDISABLE_INTERRUPTS(); + + /* Start the timer that generates the tick ISR. */ + configSETUP_TICK_INTERRUPT(); + + /* Start the first task executing. */ + vPortRestoreTaskContext(); + } + } + + return 0; +} +/*-----------------------------------------------------------*/ + +void vPortEndScheduler(void) +{ + /* Not implemented in ports where there is nothing to return to. + Artificially force an assert. */ + configASSERT(ullCriticalNesting == 1000ULL); +} +/*-----------------------------------------------------------*/ + +void vPortEnterCritical(void) +{ + /* Mask interrupts up to the max syscall interrupt priority. */ + uxPortSetInterruptMask(); + + /* Now interrupts are disabled ullCriticalNesting can be accessed + directly. Increment ullCriticalNesting to keep a count of how many times + portENTER_CRITICAL() has been called. */ + ullCriticalNesting++; + + /* This is not the interrupt safe version of the enter critical function so + assert() if it is being called from an interrupt context. Only API + functions that end in "FromISR" can be used in an interrupt. Only assert if + the critical nesting count is 1 to protect against recursive calls if the + assert function also uses a critical section. */ + if (ullCriticalNesting == 1ULL) + { + configASSERT(ullPortInterruptNesting == 0); + } +} +/*-----------------------------------------------------------*/ + +void vPortExitCritical(void) +{ + if (ullCriticalNesting > portNO_CRITICAL_NESTING) + { + /* Decrement the nesting count as the critical section is being + exited. */ + ullCriticalNesting--; + + /* If the nesting level has reached zero then all interrupt + priorities must be re-enabled. */ + if (ullCriticalNesting == portNO_CRITICAL_NESTING) + { + /* Critical nesting has reached zero so all interrupt priorities + should be unmasked. */ + portCLEAR_INTERRUPT_MASK(); + } + } +} +/*-----------------------------------------------------------*/ + +void FreeRTOS_Tick_Handler(void) +{ +/* Interrupts should not be enabled before this point. */ +#if (configASSERT_DEFINED == 1) + { + uint32_t ulMaskBits; + + __asm volatile("mrs %0, daif" + : "=r"(ulMaskBits)::"memory"); + configASSERT((ulMaskBits & portDAIF_I) != 0); + } +#endif /* configASSERT_DEFINED */ + + /* Set interrupt mask before altering scheduler structures. The tick + handler runs at the lowest priority, so interrupts cannot already be masked, + so there is no need to save and restore the current mask value. It is + necessary to turn off interrupts in the CPU itself while the ICCPMR is being + updated. */ + + setPriorityMask(configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT); + __asm volatile("dsb sy \n" + "isb sy \n" :: + : "memory"); + + /* Ok to enable interrupts after the interrupt source has been cleared. */ + configCLEAR_TICK_INTERRUPT(); + portENABLE_INTERRUPTS(); + + /* Increment the RTOS tick. */ + if (xTaskIncrementTick() != pdFALSE) + { + ullPortYieldRequired = pdTRUE; + } + + /* Ensure all interrupt priorities are active again. */ + portCLEAR_INTERRUPT_MASK(); +} +/*-----------------------------------------------------------*/ + +void vPortTaskUsesFPU(void) +{ + /* A task is registering the fact that it needs an FPU context. Set the + FPU flag (which is saved as part of the task context). */ + ullPortTaskHasFPUContext = pdTRUE; + printf("ullPortTaskHasFPUContext %x \r\n", ullPortTaskHasFPUContext); + /* Consider initialising the FPSR here - but probably not necessary in + AArch64. */ +} +/*-----------------------------------------------------------*/ + +void vPortClearInterruptMask(UBaseType_t uxNewMaskValue) +{ + if (uxNewMaskValue == pdFALSE) + { + portCLEAR_INTERRUPT_MASK(); + } +} +/*-----------------------------------------------------------*/ + +UBaseType_t uxPortSetInterruptMask(void) +{ + uint32_t ulReturn; + + /* Interrupt in the CPU must be turned off while the ICCPMR is being + updated. */ + portDISABLE_INTERRUPTS(); + if (getPriorityMask() == (uint32_t)(configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT)) + { + /* Interrupts were already masked. */ + ulReturn = pdTRUE; + } + else + { + ulReturn = pdFALSE; + setPriorityMask(configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT); + // portICCPMR_PRIORITY_MASK_REGISTER = (uint32_t)(configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT); + __asm volatile("dsb sy \n" + "isb sy \n" :: + : "memory"); + } + portENABLE_INTERRUPTS(); + + return ulReturn; +} +/*-----------------------------------------------------------*/ + +#if (configASSERT_DEFINED == 1) + +void vPortValidateInterruptPriority(void) +{ + /* The following assertion will fail if a service routine (ISR) for + an interrupt that has been assigned a priority above + configMAX_SYSCALL_INTERRUPT_PRIORITY calls an ISR safe FreeRTOS API + function. ISR safe FreeRTOS API functions must *only* be called + from interrupts that have been assigned a priority at or below + configMAX_SYSCALL_INTERRUPT_PRIORITY. + + Numerically low interrupt priority numbers represent logically high + interrupt priorities, therefore the priority of the interrupt must + be set to a value equal to or numerically *higher* than + configMAX_SYSCALL_INTERRUPT_PRIORITY. + + FreeRTOS maintains separate thread and ISR API functions to ensure + interrupt entry is as fast and simple as possible. */ + configASSERT(getRunningPriority() >= (uint32_t)(configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT)); + + /* Priority grouping: The interrupt controller (GIC) allows the bits + that define each interrupt's priority to be split between bits that + define the interrupt's pre-emption priority bits and bits that define + the interrupt's sub-priority. For simplicity all bits must be defined + to be pre-emption priority bits. The following assertion will fail if + this is not the case (if some bits represent a sub-priority). + + The priority grouping is configured by the GIC's binary point register + (ICCBPR). Writting 0 to ICCBPR will ensure it is set to its lowest + possible value (which may be above 0). */ + configASSERT((getBPR1() & portBINARY_POINT_BITS) <= portMAX_BINARY_POINT_VALUE); +} + +#endif /* configASSERT_DEFINED */ +/*-----------------------------------------------------------*/ + +_WEAK void vApplicationTickHook(void) +{ +} + +_WEAK void vApplicationIdleHook(void) +{ +} diff --git a/third-party/freertos/portable/GCC/ft_platform_o/aarch64/portASM.S b/third-party/freertos/portable/GCC/ft_platform_o/aarch64/portASM.S new file mode 100644 index 00000000..5530452f --- /dev/null +++ b/third-party/freertos/portable/GCC/ft_platform_o/aarch64/portASM.S @@ -0,0 +1,433 @@ +/* + * FreeRTOS Kernel V10.0.1 + * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * http://www.FreeRTOS.org + * http://aws.amazon.com/freertos + * + * 1 tab == 4 spaces! + */ +#include "gicv3_aliases.h" + + .text + + /* Variables and functions. */ + .extern ullMaxAPIPriorityMask + .extern pxCurrentTCB + .extern vTaskSwitchContext + .extern vApplicationIRQHandler + .extern ullPortInterruptNesting + .extern ullPortTaskHasFPUContext + .extern ullCriticalNesting + .extern ullPortYieldRequired + .extern ullICCEOIR + .extern ullICCIAR + .extern _freertos_vector_table + + .global FreeRTOS_IRQ_Handler + .global FreeRTOS_SWI_Handler + .global vPortRestoreTaskContext + + + + +.macro portSAVE_CONTEXT + /* Switch to use the EL0 stack pointer. */ + MSR SPSEL, #0 + + /* Save the entire context. */ + STP X0, X1, [SP, #-0x10]! + STP X2, X3, [SP, #-0x10]! + STP X4, X5, [SP, #-0x10]! + STP X6, X7, [SP, #-0x10]! + STP X8, X9, [SP, #-0x10]! + STP X10, X11, [SP, #-0x10]! + STP X12, X13, [SP, #-0x10]! + STP X14, X15, [SP, #-0x10]! + STP X16, X17, [SP, #-0x10]! + STP X18, X19, [SP, #-0x10]! + STP X20, X21, [SP, #-0x10]! + STP X22, X23, [SP, #-0x10]! + STP X24, X25, [SP, #-0x10]! + STP X26, X27, [SP, #-0x10]! + STP X28, X29, [SP, #-0x10]! + STP X30, XZR, [SP, #-0x10]! + + /* Save the SPSR. */ +#if defined( GUEST ) + MRS X3, SPSR_EL1 + MRS X2, ELR_EL1 +#else + MRS X3, SPSR_EL3 + /* Save the ELR. */ + MRS X2, ELR_EL3 +#endif + + STP X2, X3, [SP, #-0x10]! + + /* Save the critical section nesting depth. */ + LDR X0, ullCriticalNestingConst + LDR X3, [X0] + + /* Save the FPU context indicator. */ + LDR X0, ullPortTaskHasFPUContextConst + LDR X2, [X0] + + /* Save the FPU context, if any (32 128-bit registers). */ + CMP X2, #0 + B.EQ 1f + STP Q0, Q1, [SP,#-0x20]! + STP Q2, Q3, [SP,#-0x20]! + STP Q4, Q5, [SP,#-0x20]! + STP Q6, Q7, [SP,#-0x20]! + STP Q8, Q9, [SP,#-0x20]! + STP Q10, Q11, [SP,#-0x20]! + STP Q12, Q13, [SP,#-0x20]! + STP Q14, Q15, [SP,#-0x20]! + STP Q16, Q17, [SP,#-0x20]! + STP Q18, Q19, [SP,#-0x20]! + STP Q20, Q21, [SP,#-0x20]! + STP Q22, Q23, [SP,#-0x20]! + STP Q24, Q25, [SP,#-0x20]! + STP Q26, Q27, [SP,#-0x20]! + STP Q28, Q29, [SP,#-0x20]! + STP Q30, Q31, [SP,#-0x20]! + +1: + /* Store the critical nesting count and FPU context indicator. */ + STP X2, X3, [SP, #-0x10]! + + LDR X0, pxCurrentTCBConst + LDR X1, [X0] + MOV X0, SP /* Move SP into X0 for saving. */ + STR X0, [X1] + + /* Switch to use the ELx stack pointer. */ + MSR SPSEL, #1 + + .endm + +; /**********************************************************************/ + + + + +.macro portRESTORE_CONTEXT + + /* Switch to use the EL0 stack pointer. */ + MSR SPSEL, #0 + + /* Set the SP to point to the stack of the task being restored. */ + LDR X0, pxCurrentTCBConst + LDR X1, [X0] + LDR X0, [X1] + MOV SP, X0 + + LDP X2, X3, [SP], #0x10 /* Critical nesting and FPU context. */ + + /* Set the PMR register to be correct for the current critical nesting + depth. */ + LDR X0, ullCriticalNestingConst /* X0 holds the address of ullCriticalNesting. */ + MOV X1, #255 /* X1 holds the unmask value. */ + CMP X3, #0 + B.EQ 1f + LDR X6, ullMaxAPIPriorityMaskConst + LDR X1, [X6] /* X1 holds the mask value. */ +1: + //STR W1, [X5] /* Write the mask value to ICCPMR. */ + MSR S3_0_C4_C6_0, X1 + DSB SY /* _RB_Barriers probably not required here. */ + ISB SY + STR X3, [X0] /* Restore the task's critical nesting count. */ + + /* Restore the FPU context indicator. */ + LDR X0, ullPortTaskHasFPUContextConst + STR X2, [X0] + + /* Restore the FPU context, if any. */ + CMP X2, #0 + B.EQ 1f + + LDP Q30, Q31, [SP], #0x20 + LDP Q28, Q29, [SP], #0x20 + LDP Q26, Q27, [SP], #0x20 + LDP Q24, Q25, [SP], #0x20 + LDP Q22, Q23, [SP], #0x20 + LDP Q20, Q21, [SP], #0x20 + LDP Q18, Q19, [SP], #0x20 + LDP Q16, Q17, [SP], #0x20 + LDP Q14, Q15, [SP], #0x20 + LDP Q12, Q13, [SP], #0x20 + LDP Q10, Q11, [SP], #0x20 + LDP Q8, Q9, [SP], #0x20 + LDP Q6, Q7, [SP], #0x20 + LDP Q4, Q5, [SP], #0x20 + LDP Q2, Q3, [SP], #0x20 + LDP Q0, Q1, [SP], #0x20 +1: + LDP X2, X3, [SP], #0x10 /* SPSR and ELR. */ + +#if defined( GUEST ) + /* Restore the SPSR. */ + MSR SPSR_EL1, X3 + /* Restore the ELR. */ + MSR ELR_EL1, X2 +#else + /* Restore the SPSR. */ + MSR SPSR_EL3, X3 /*_RB_ Assumes started in EL3. */ + /* Restore the ELR. */ + MSR ELR_EL3, X2 +#endif + + LDP X30, XZR, [SP], #0x10 + LDP X28, X29, [SP], #0x10 + LDP X26, X27, [SP], #0x10 + LDP X24, X25, [SP], #0x10 + LDP X22, X23, [SP], #0x10 + LDP X20, X21, [SP], #0x10 + LDP X18, X19, [SP], #0x10 + LDP X16, X17, [SP], #0x10 + LDP X14, X15, [SP], #0x10 + LDP X12, X13, [SP], #0x10 + LDP X10, X11, [SP], #0x10 + LDP X8, X9, [SP], #0x10 + LDP X6, X7, [SP], #0x10 + LDP X4, X5, [SP], #0x10 + LDP X2, X3, [SP], #0x10 + LDP X0, X1, [SP], #0x10 + + /* Switch to use the ELx stack pointer. _RB_ Might not be required. */ + MSR SPSEL, #1 + + ERET + + .endm + + +/****************************************************************************** + * FreeRTOS_SWI_Handler handler is used to perform a context switch. + *****************************************************************************/ +.align 8 +.type FreeRTOS_SWI_Handler, %function +FreeRTOS_SWI_Handler: + /* Save the context of the current task and select a new task to run. */ + portSAVE_CONTEXT +#if defined( GUEST ) + MRS X0, ESR_EL1 +#else + MRS X0, ESR_EL3 +#endif + + LSR X1, X0, #26 + +#if defined( GUEST ) + CMP X1, #0x15 /* 0x15 = SVC instruction. */ +#else + CMP X1, #0x17 /* 0x17 = SMC instruction. */ +#endif + B.NE FreeRTOS_Abort + BL vTaskSwitchContext + + portRESTORE_CONTEXT + +FreeRTOS_Abort: + /* Full ESR is in X0, exception class code is in X1. */ + B . + +/****************************************************************************** + * vPortRestoreTaskContext is used to start the scheduler. + *****************************************************************************/ +.align 8 +.type vPortRestoreTaskContext, %function +vPortRestoreTaskContext: +.set freertos_vector_base, _freertos_vector_table + + /* Install the FreeRTOS interrupt handlers. */ + LDR X1, =freertos_vector_base +#if defined( GUEST ) + MSR VBAR_EL1, X1 +#else + MSR VBAR_EL3, X1 +#endif + DSB SY + ISB SY + + /* Start the first task. */ + portRESTORE_CONTEXT + + +/****************************************************************************** + * FreeRTOS_IRQ_Handler handles IRQ entry and exit. + *****************************************************************************/ +.align 8 +.type FreeRTOS_IRQ_Handler, %function +FreeRTOS_IRQ_Handler: + /* Save volatile registers. */ + STP X0, X1, [SP, #-0x10]! + STP X2, X3, [SP, #-0x10]! + STP X4, X5, [SP, #-0x10]! + STP X6, X7, [SP, #-0x10]! + STP X8, X9, [SP, #-0x10]! + STP X10, X11, [SP, #-0x10]! + STP X12, X13, [SP, #-0x10]! + STP X14, X15, [SP, #-0x10]! + STP X16, X17, [SP, #-0x10]! + STP X18, X19, [SP, #-0x10]! + STP X29, X30, [SP, #-0x10]! + + /* Save the SPSR and ELR. */ +#if defined( GUEST ) + MRS X3, SPSR_EL1 + MRS X2, ELR_EL1 +#else + MRS X3, SPSR_EL3 + MRS X2, ELR_EL3 +#endif + STP X2, X3, [SP, #-0x10]! + + /* Increment the interrupt nesting counter. */ + LDR X5, ullPortInterruptNestingConst + LDR X1, [X5] /* Old nesting count in X1. */ + ADD X6, X1, #1 + STR X6, [X5] /* Address of nesting count variable in X5. */ + + /* Maintain the interrupt nesting information across the function call. */ + STP X1, X5, [SP, #-0x10]! + + + /* Read value from the interrupt acknowledge register, which is stored in W0 + for future parameter and interrupt clearing use. */ + + MRS X0, ICC_IAR1_EL1 /* ICCIAR in x0 as parameter. */ + + /* Maintain the ICCIAR value across the function call. */ + STP X0, X1, [SP, #-0x10]! + + /* Call the C handler. */ + BL vApplicationIRQHandler + + /* Disable interrupts. */ + MSR DAIFSET, #2 + DSB SY + ISB SY + + /* Restore the ICCIAR value. */ + LDP X0, X1, [SP], #0x10 + + /* End IRQ processing by writing ICCIAR to the EOI register. */ + + MSR ICC_EOIR1_EL1, x0 + + + /* Restore the critical nesting count. */ + LDP X1, X5, [SP], #0x10 + STR X1, [X5] + + /* Has interrupt nesting unwound? */ + CMP X1, #0 + B.NE Exit_IRQ_No_Context_Switch + + /* Is a context switch required? */ + LDR X0, ullPortYieldRequiredConst + LDR X1, [X0] + CMP X1, #0 + B.EQ Exit_IRQ_No_Context_Switch + + /* Reset ullPortYieldRequired to 0. */ + MOV X2, #0 + STR X2, [X0] + + /* Restore volatile registers. */ + LDP X4, X5, [SP], #0x10 /* SPSR and ELR. */ +#if defined( GUEST ) + MSR SPSR_EL1, X5 + MSR ELR_EL1, X4 +#else + MSR SPSR_EL3, X5 /*_RB_ Assumes started in EL3. */ + MSR ELR_EL3, X4 +#endif + DSB SY + ISB SY + + LDP X29, X30, [SP], #0x10 + LDP X18, X19, [SP], #0x10 + LDP X16, X17, [SP], #0x10 + LDP X14, X15, [SP], #0x10 + LDP X12, X13, [SP], #0x10 + LDP X10, X11, [SP], #0x10 + LDP X8, X9, [SP], #0x10 + LDP X6, X7, [SP], #0x10 + LDP X4, X5, [SP], #0x10 + LDP X2, X3, [SP], #0x10 + LDP X0, X1, [SP], #0x10 + + /* Save the context of the current task and select a new task to run. */ + portSAVE_CONTEXT + BL vTaskSwitchContext + portRESTORE_CONTEXT + +Exit_IRQ_No_Context_Switch: + /* Restore volatile registers. */ + LDP X4, X5, [SP], #0x10 /* SPSR and ELR. */ +#if defined( GUEST ) + MSR SPSR_EL1, X5 + MSR ELR_EL1, X4 +#else + MSR SPSR_EL3, X5 /*_RB_ Assumes started in EL3. */ + MSR ELR_EL3, X4 +#endif + DSB SY + ISB SY + + LDP X29, X30, [SP], #0x10 + LDP X18, X19, [SP], #0x10 + LDP X16, X17, [SP], #0x10 + LDP X14, X15, [SP], #0x10 + LDP X12, X13, [SP], #0x10 + LDP X10, X11, [SP], #0x10 + LDP X8, X9, [SP], #0x10 + LDP X6, X7, [SP], #0x10 + LDP X4, X5, [SP], #0x10 + LDP X2, X3, [SP], #0x10 + LDP X0, X1, [SP], #0x10 + + ERET + + + + +.align 8 +pxCurrentTCBConst: .dword pxCurrentTCB +ullCriticalNestingConst: .dword ullCriticalNesting +ullPortTaskHasFPUContextConst: .dword ullPortTaskHasFPUContext +ullMaxAPIPriorityMaskConst: .dword ullMaxAPIPriorityMask +vApplicationIRQHandlerConst: .dword vApplicationIRQHandler +ullPortInterruptNestingConst: .dword ullPortInterruptNesting +ullPortYieldRequiredConst: .dword ullPortYieldRequired + + + + +.end + + + + + diff --git a/third-party/freertos/portable/GCC/ft_platform_o/aarch64/portmacro.h b/third-party/freertos/portable/GCC/ft_platform_o/aarch64/portmacro.h new file mode 100644 index 00000000..ad1b1364 --- /dev/null +++ b/third-party/freertos/portable/GCC/ft_platform_o/aarch64/portmacro.h @@ -0,0 +1,211 @@ +/* + * FreeRTOS Kernel V10.0.1 + * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of + * the Software, and to permit persons to whom the Software is furnished to do so, + * subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS + * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * http://www.FreeRTOS.org + * http://aws.amazon.com/freertos + * + * 1 tab == 4 spaces! + */ + +#ifndef PORTMACRO_H +#define PORTMACRO_H + +#ifdef __cplusplus +extern "C" +{ +#endif +#include "ft_types.h" +/*----------------------------------------------------------- + * Port specific definitions. + * + * The settings in this file configure FreeRTOS correctly for the given hardware + * and compiler. + * + * These settings should not be altered. + *----------------------------------------------------------- + */ + +/* Type definitions. */ +#define portCHAR char +#define portFLOAT float +#define portDOUBLE double +#define portLONG long +#define portSHORT short +#define portSTACK_TYPE size_t +#define portBASE_TYPE long + + typedef portSTACK_TYPE StackType_t; + typedef portBASE_TYPE BaseType_t; + typedef uint64_t UBaseType_t; + + typedef uint64_t TickType_t; +#define portMAX_DELAY ((TickType_t)0xffffffffffffffff) + +/* 32-bit tick type on a 32-bit architecture, so reads of the tick count do +not need to be guarded with a critical section. */ +#define portTICK_TYPE_IS_ATOMIC 1 + +/*-----------------------------------------------------------*/ + +/* Hardware specifics. */ +#define portSTACK_GROWTH (-1) +#define portTICK_PERIOD_MS ((TickType_t)1000 / configTICK_RATE_HZ) +#define portBYTE_ALIGNMENT 16 +#define portPOINTER_SIZE_TYPE uint64_t + +/*-----------------------------------------------------------*/ + +/* Task utilities. */ + +/* Called at the end of an ISR that can cause a context switch. */ +#define portEND_SWITCHING_ISR(xSwitchRequired) \ + { \ + extern uint64_t ullPortYieldRequired; \ + \ + if (xSwitchRequired != pdFALSE) \ + { \ + ullPortYieldRequired = pdTRUE; \ + } \ + } + +#define portYIELD_FROM_ISR(x) portEND_SWITCHING_ISR(x) +#if defined(GUEST) +#define portYIELD() __asm volatile("SVC 0" :: \ + : "memory") +#else +#define portYIELD() __asm volatile("SMC 0" :: \ + : "memory") +#endif + /*----------------------------------------------------------- + * Critical section control + *----------------------------------------------------------*/ + + extern void vPortEnterCritical(void); + extern void vPortExitCritical(void); + extern UBaseType_t uxPortSetInterruptMask(void); + extern void vPortClearInterruptMask(UBaseType_t uxNewMaskValue); + extern void vPortInstallFreeRTOSVectorTable(void); + +#define portDISABLE_INTERRUPTS() \ + __asm volatile("MSR DAIFSET, #2" :: \ + : "memory"); \ + __asm volatile("DSB SY"); \ + __asm volatile("ISB SY"); + +#define portENABLE_INTERRUPTS() \ + __asm volatile("MSR DAIFCLR, #2" :: \ + : "memory"); \ + __asm volatile("DSB SY"); \ + __asm volatile("ISB SY"); + +/* These macros do not globally disable/enable interrupts. They do mask off +interrupts that have a priority below configMAX_API_CALL_INTERRUPT_PRIORITY. */ +#define portENTER_CRITICAL() vPortEnterCritical(); +#define portEXIT_CRITICAL() vPortExitCritical(); +#define portSET_INTERRUPT_MASK_FROM_ISR() uxPortSetInterruptMask() +#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vPortClearInterruptMask(x) + +/*-----------------------------------------------------------*/ + +/* Task function macros as described on the FreeRTOS.org WEB site. These are +not required for this port but included in case common demo code that uses these +macros is used. */ +#define portTASK_FUNCTION_PROTO(vFunction, pvParameters) void vFunction(void *pvParameters) +#define portTASK_FUNCTION(vFunction, pvParameters) void vFunction(void *pvParameters) + + /* Prototype of the FreeRTOS tick handler. This must be installed as the +handler for whichever peripheral is used to generate the RTOS tick. */ + void FreeRTOS_Tick_Handler(void); + + /* Any task that uses the floating point unit MUST call vPortTaskUsesFPU() +before any floating point instructions are executed. */ + void vPortTaskUsesFPU(void); +#define portTASK_USES_FLOATING_POINT() vPortTaskUsesFPU() + +#define portLOWEST_INTERRUPT_PRIORITY (((uint32_t)configUNIQUE_INTERRUPT_PRIORITIES) - 1UL) +#define portLOWEST_USABLE_INTERRUPT_PRIORITY (portLOWEST_INTERRUPT_PRIORITY - 1UL) + +/* Architecture specific optimisations. */ +#ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION +#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 +#endif + +#if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1 + +/* Store/clear the ready priorities in a bit map. */ +#define portRECORD_READY_PRIORITY(uxPriority, uxReadyPriorities) (uxReadyPriorities) |= (1UL << (uxPriority)) +#define portRESET_READY_PRIORITY(uxPriority, uxReadyPriorities) (uxReadyPriorities) &= ~(1UL << (uxPriority)) + + /*-----------------------------------------------------------*/ + +#define portGET_HIGHEST_PRIORITY(uxTopPriority, uxReadyPriorities) uxTopPriority = (31 - __builtin_clz(uxReadyPriorities)) + +#endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */ + +#ifdef configASSERT + void vPortValidateInterruptPriority(void); +#define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() vPortValidateInterruptPriority() +#endif /* configASSERT */ + +#define portNOP() __asm volatile("NOP") +#define portINLINE __inline + +#ifdef __cplusplus +} /* extern C */ +#endif + +/* The number of bits to shift for an interrupt priority is dependent on the +number of bits implemented by the interrupt controller. */ +#if configUNIQUE_INTERRUPT_PRIORITIES == 16 +#define portPRIORITY_SHIFT 4 +#define portMAX_BINARY_POINT_VALUE 3 +#elif configUNIQUE_INTERRUPT_PRIORITIES == 32 +#define portPRIORITY_SHIFT 3 +#define portMAX_BINARY_POINT_VALUE 2 +#elif configUNIQUE_INTERRUPT_PRIORITIES == 64 +#define portPRIORITY_SHIFT 2 +#define portMAX_BINARY_POINT_VALUE 1 +#elif configUNIQUE_INTERRUPT_PRIORITIES == 128 +#define portPRIORITY_SHIFT 1 +#define portMAX_BINARY_POINT_VALUE 0 +#elif configUNIQUE_INTERRUPT_PRIORITIES == 256 +#define portPRIORITY_SHIFT 0 +#define portMAX_BINARY_POINT_VALUE 0 +#else +#error Invalid configUNIQUE_INTERRUPT_PRIORITIES setting. configUNIQUE_INTERRUPT_PRIORITIES must be set to the number of unique priorities implemented by the target hardware +#endif + +/* Interrupt controller access addresses. */ +#define portICCPMR_PRIORITY_MASK_OFFSET (0x04) +#define portICCIAR_INTERRUPT_ACKNOWLEDGE_OFFSET (0x0C) +#define portICCEOIR_END_OF_INTERRUPT_OFFSET (0x10) +#define portICCBPR_BINARY_POINT_OFFSET (0x08) +#define portICCRPR_RUNNING_PRIORITY_OFFSET (0x14) + +// #define portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS (GIC_GICC_BASE) +// #define portICCPMR_PRIORITY_MASK_REGISTER (*((volatile uint32_t *)(portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCPMR_PRIORITY_MASK_OFFSET))) +// #define portICCIAR_INTERRUPT_ACKNOWLEDGE_REGISTER_ADDRESS (portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCIAR_INTERRUPT_ACKNOWLEDGE_OFFSET) +// #define portICCEOIR_END_OF_INTERRUPT_REGISTER_ADDRESS (portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCEOIR_END_OF_INTERRUPT_OFFSET) +// #define portICCPMR_PRIORITY_MASK_REGISTER_ADDRESS (portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCPMR_PRIORITY_MASK_OFFSET) +// #define portICCBPR_BINARY_POINT_REGISTER (*((const volatile uint32_t *)(portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCBPR_BINARY_POINT_OFFSET))) +// #define portICCRPR_RUNNING_PRIORITY_REGISTER (*((const volatile uint32_t *)(portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCRPR_RUNNING_PRIORITY_OFFSET))) + +#endif /* PORTMACRO_H */ diff --git a/third-party/freertos/portable/freertos_configs.c b/third-party/freertos/portable/freertos_configs.c index 6430e7d4..0e40b912 100644 --- a/third-party/freertos/portable/freertos_configs.c +++ b/third-party/freertos/portable/freertos_configs.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0. * * @Date: 2021-07-05 08:35:41 - * @LastEditTime: 2021-07-21 19:04:40 + * @LastEditTime: 2021-12-15 16:59:45 * @Description:  This files is for * * @Modify History: @@ -18,7 +18,6 @@ #include "gicv3.h" #include "generic_timer.h" #include "interrupt.h" -#include "trap.h" #include #include "ft_assert.h" @@ -59,7 +58,7 @@ void vConfigureTickInterrupt(void) GenericTimerStop(); // Get system frequency cntfrq = GenericTimerFrequecy(); - + // Set tick rate GenericTimerCompare(cntfrq / configTICK_RATE_HZ); GenericTimerInterruptEnable(); @@ -97,10 +96,15 @@ void vApplicationIRQHandler(uint32_t ulICCIAR) } else { - SystemIrqHandler(ulInterruptID); + printf("IRQInterrupt is exit \r\n") ; + // SystemIrqHandler(ulInterruptID); + IRQInterrupt(NULL) ; } } #else + +extern void IrqInterruptHandler(void) ; + void vApplicationFPUSafeIRQHandler(uint32_t ulICCIAR) { int ulInterruptID; @@ -116,11 +120,10 @@ void vApplicationFPUSafeIRQHandler(uint32_t ulICCIAR) /* Generic Timer */ gCpuRuntime++; FreeRTOS_Tick_Handler(); - } else { - SystemIrqHandler(ulInterruptID); + IrqInterruptHandler(); } } #endif diff --git a/third-party/freertos/portable/freertos_configs.c_o b/third-party/freertos/portable/freertos_configs.c_o new file mode 100644 index 00000000..84b3ede1 --- /dev/null +++ b/third-party/freertos/portable/freertos_configs.c_o @@ -0,0 +1,194 @@ +/* + * @ : Copyright (c) 2021 Phytium Information Technology, Inc. + * + * SPDX-License-Identifier: Apache-2.0. + * + * @Date: 2021-07-05 08:35:41 + * @LastEditTime: 2021-12-15 15:51:41 + * @Description:  This files is for + * + * @Modify History: + * Ver   Who        Date         Changes + * ----- ------     --------    -------------------------------------- + */ +#include "FreeRTOS.h" +#include "task.h" +#include "ft_types.h" +#include "parameters.h" +#include "gicv3.h" +#include "generic_timer.h" +#include "interrupt.h" +#include "trap.h" +#include +#include "ft_assert.h" + +void vMainAssertCalled(const char *pcFileName, uint32_t ulLineNumber) +{ + printf("Assert Error is %s : %d \r\n", pcFileName, ulLineNumber); + for (;;) + ; +} + +void vApplicationMallocFailedHook(void) +{ + printf("Malloc Failed\r\n"); + while (1) + ; +} + +void vApplicationTickHook(void) +{ + +} + +void vApplicationIdleHook(void) +{ + +} + +u32 PlatformGetGicDistBase(void) +{ + return GICV3_BASEADDRESS; +} + +static u32 cntfrq; /* System frequency */ + +void vConfigureTickInterrupt(void) +{ + // Disable the timer + GenericTimerStop(); + // Get system frequency + cntfrq = GenericTimerFrequecy(); + + // Set tick rate + GenericTimerCompare(cntfrq / configTICK_RATE_HZ); + GenericTimerInterruptEnable(); + + // Set as the lowest priority + InterruptSetPriority(GENERIC_TIMER_NS_IRQ_NUM, configKERNEL_INTERRUPT_PRIORITY); + InterruptUmask(GENERIC_TIMER_NS_IRQ_NUM); + + GenericTimerStart(); +} + +void vClearTickInterrupt(void) +{ + GenericTimerCompare(cntfrq / configTICK_RATE_HZ); +} + +volatile unsigned int gCpuRuntime; + +#ifdef __aarch64__ +void vApplicationIRQHandler(uint32_t ulICCIAR) +{ + int ulInterruptID; + + /* Interrupts cannot be re-enabled until the source of the interrupt is + cleared. The ID of the interrupt is obtained by bitwise ANDing the ICCIAR + value with 0x3FF. */ + ulInterruptID = ulICCIAR & 0x3FFUL; + + /* call handler function */ + if (ulInterruptID == 30) + { + /* Generic Timer */ + gCpuRuntime++; + FreeRTOS_Tick_Handler(); + } + else + { + SystemIrqHandler(ulInterruptID); + } +} +#else +void vApplicationFPUSafeIRQHandler(uint32_t ulICCIAR) +{ + int ulInterruptID; + + /* Interrupts cannot be re-enabled until the source of the interrupt is + cleared. The ID of the interrupt is obtained by bitwise ANDing the ICCIAR + value with 0x3FF. */ + ulInterruptID = ulICCIAR & 0x3FFUL; + + /* call handler function */ + if (ulInterruptID == 30) + { + /* Generic Timer */ + gCpuRuntime++; + FreeRTOS_Tick_Handler(); + + } + else + { + SystemIrqHandler(ulInterruptID); + } +} +#endif + + + +void InitIrq() +{ + /* interrupt init */ + ArmGicRedistAddressSet(0, GICV3_RD_BASEADDRESS + 0, 0); + InterruptInit(GICV3_BASEADDRESS, 0); +} + + +void vApplicationStackOverflowHook(xTaskHandle pxTask, signed char *pcTaskName) +{ + (void) pxTask; + (void) pcTaskName; + + taskDISABLE_INTERRUPTS(); + FT_ASSERTNONERETURN(FALSE); + +} + +/* configSUPPORT_STATIC_ALLOCATION is set to 1, so the application must provide an + * implementation of vApplicationGetIdleTaskMemory() to provide the memory that is + * used by the Idle task. */ +void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) +{ + /* If the buffers to be provided to the Idle task are declared inside this + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xIdleTaskTCB; + static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Idle task's + state will be stored. */ + *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; + + /* Pass out the array that will be used as the Idle task's stack. */ + *ppxIdleTaskStackBuffer = uxIdleTaskStack; + + /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. + Note that, as the array is necessarily of type StackType_t, + configMINIMAL_STACK_SIZE is specified in words, not bytes. */ + *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; +} + +/* configSUPPORT_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the + * application must provide an implementation of vApplicationGetTimerTaskMemory() + * to provide the memory that is used by the Timer service task. */ +void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) +{ + /* If the buffers to be provided to the Timer task are declared inside this + * function then they must be declared static - otherwise they will be allocated on + * the stack and so not exists after this function exits. */ + static StaticTask_t xTimerTaskTCB; + static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; + + /* Pass out a pointer to the StaticTask_t structure in which the Timer + task's state will be stored. */ + *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; + + /* Pass out the array that will be used as the Timer task's stack. */ + *ppxTimerTaskStackBuffer = uxTimerTaskStack; + + /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. + Note that, as the array is necessarily of type StackType_t, + configTIMER_TASK_STACK_DEPTH is specified in words, not bytes. */ + *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; +} diff --git a/third-party/freertos/tasks.c b/third-party/freertos/tasks.c index c56fe949..aa46398d 100644 --- a/third-party/freertos/tasks.c +++ b/third-party/freertos/tasks.c @@ -1998,7 +1998,6 @@ void vTaskStartScheduler(void) portCONFIGURE_TIMER_FOR_RUN_TIME_STATS(); /* Setting up the timer tick is hardware specific and thus in the portable interface. */ - if (xPortStartScheduler() != pdFALSE) { /* Should not reach here as if the scheduler is running the diff --git a/third-party/freertos/timers.c b/third-party/freertos/timers.c index a6df4c48..37b445b4 100644 --- a/third-party/freertos/timers.c +++ b/third-party/freertos/timers.c @@ -504,7 +504,7 @@ static void prvTimerTask(void *pvParameters) /* Just to avoid compiler warnings. */ (void)pvParameters; - + printf("prvTimerTask \r\n") ; #if (configUSE_DAEMON_TASK_STARTUP_HOOK == 1) { extern void vApplicationDaemonTaskStartupHook(void); -- Gitee From f8af15db96b7fd31d097e8810d6e25e8aa88720d Mon Sep 17 00:00:00 2001 From: root Date: Thu, 16 Dec 2021 09:42:13 +0800 Subject: [PATCH 03/14] =?UTF-8?q?=E5=AE=8C=E6=88=90arch=E9=83=A8=E5=88=86?= =?UTF-8?q?=E9=80=82=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 6 +- example/function_test/sdkconfig | 6 +- example/function_test/sdkconfig.h | 6 +- example/lwip_test/sdkconfig | 24 +- example/lwip_test/sdkconfig.h | 23 +- git | Bin 0 -> 20480 bytes make/complier.mk | 2 +- standalone_adaptive.mk | 1 + standalone_o | 1 - third-party/Kconfig | 6 - .../portable/GCC/ft_platform/aarch64/boot.S | 126 ++++ .../GCC/ft_platform/aarch64/portASM.S | 3 +- .../GCC/ft_platform/aarch64/vectors.S | 68 ++- .../ft_platform_o/aarch32/FreeRTOSConfig.h | 250 -------- .../portable/GCC/ft_platform_o/aarch32/port.c | 554 ------------------ .../GCC/ft_platform_o/aarch32/portASM.S | 339 ----------- .../GCC/ft_platform_o/aarch32/portmacro.h | 201 ------- .../ft_platform_o/aarch64/FreeRTOSConfig.h | 191 ------ .../portable/GCC/ft_platform_o/aarch64/port.c | 514 ---------------- .../GCC/ft_platform_o/aarch64/portASM.S | 433 -------------- .../GCC/ft_platform_o/aarch64/portmacro.h | 211 ------- 21 files changed, 218 insertions(+), 2747 deletions(-) create mode 100644 git delete mode 160000 standalone_o create mode 100644 third-party/freertos/portable/GCC/ft_platform/aarch64/boot.S delete mode 100644 third-party/freertos/portable/GCC/ft_platform_o/aarch32/FreeRTOSConfig.h delete mode 100644 third-party/freertos/portable/GCC/ft_platform_o/aarch32/port.c delete mode 100644 third-party/freertos/portable/GCC/ft_platform_o/aarch32/portASM.S delete mode 100644 third-party/freertos/portable/GCC/ft_platform_o/aarch32/portmacro.h delete mode 100644 third-party/freertos/portable/GCC/ft_platform_o/aarch64/FreeRTOSConfig.h delete mode 100644 third-party/freertos/portable/GCC/ft_platform_o/aarch64/port.c delete mode 100644 third-party/freertos/portable/GCC/ft_platform_o/aarch64/portASM.S delete mode 100644 third-party/freertos/portable/GCC/ft_platform_o/aarch64/portmacro.h diff --git a/.gitignore b/.gitignore index 8c7644b6..14abf374 100644 --- a/.gitignore +++ b/.gitignore @@ -63,6 +63,6 @@ dkms.conf /tools/gdb-* # Standalone sdk -#standalone -#sdk -#phytium-standalone-sdk \ No newline at end of file +standalone +sdk +phytium-standalone-sdk \ No newline at end of file diff --git a/example/function_test/sdkconfig b/example/function_test/sdkconfig index b77e1fd4..e3238901 100644 --- a/example/function_test/sdkconfig +++ b/example/function_test/sdkconfig @@ -25,9 +25,9 @@ CONFIG_USE_SYS_TICK=y # # Board Configuration # -CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_F2000_4 is not set # CONFIG_TARGET_E2000 is not set -# CONFIG_TARGET_D2000 is not set +CONFIG_TARGET_D2000=y # end of Board Configuration # @@ -103,7 +103,7 @@ CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 CONFIG_HEAP_SIZE=1 -CONFIG_STACK_SIZE=0x40000 +CONFIG_STACK_SIZE=0x400 # end of Linker Options # end of Building Option diff --git a/example/function_test/sdkconfig.h b/example/function_test/sdkconfig.h index be7ab79d..45a6acbb 100644 --- a/example/function_test/sdkconfig.h +++ b/example/function_test/sdkconfig.h @@ -23,9 +23,9 @@ /* Board Configuration */ -#define CONFIG_TARGET_F2000_4 +/* CONFIG_TARGET_F2000_4 is not set */ /* CONFIG_TARGET_E2000 is not set */ -/* CONFIG_TARGET_D2000 is not set */ +#define CONFIG_TARGET_D2000 /* end of Board Configuration */ /* Components Configuration */ @@ -90,7 +90,7 @@ #define CONFIG_RAM_START_UP_ADDR 0x81000000 #define CONFIG_RAM_SIZE_MB 64 #define CONFIG_HEAP_SIZE 1 -#define CONFIG_STACK_SIZE 0x40000 +#define CONFIG_STACK_SIZE 0x400 /* end of Linker Options */ /* end of Building Option */ diff --git a/example/lwip_test/sdkconfig b/example/lwip_test/sdkconfig index fdd0967c..36bc0c82 100644 --- a/example/lwip_test/sdkconfig +++ b/example/lwip_test/sdkconfig @@ -27,9 +27,9 @@ CONFIG_USE_SYS_TICK=y # # Board Configuration # -CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_F2000_4 is not set # CONFIG_TARGET_E2000 is not set -# CONFIG_TARGET_D2000 is not set +CONFIG_TARGET_D2000=y # end of Board Configuration # @@ -38,7 +38,7 @@ CONFIG_TARGET_F2000_4=y # CONFIG_USE_SPI is not set # CONFIG_USE_QSPI is not set CONFIG_USE_GIC=y -CONFIG_EBABLE_GICV3=y +CONFIG_ENABLE_GICV3=y CONFIG_USE_SERIAL=y # @@ -54,15 +54,8 @@ CONFIG_USE_ETH=y # # Eth Configuration # -# CONFIG_ENABLE_F_XMAC is not set -CONFIG_ENABLE_F_GMAC=y - -# -# F_GMAC Configuration -# -# CONFIG_F_GMAC_PHY_COMMON is not set -CONFIG_F_GMAC_PHY_AR803X=y -# end of F_GMAC Configuration +# CONFIG_ENABLE_FXMAC is not set +# CONFIG_ENABLE_FGMAC is not set # end of Eth Configuration # CONFIG_USE_CAN is not set @@ -73,6 +66,7 @@ CONFIG_F_GMAC_PHY_AR803X=y # CONFIG_USE_WDT is not set # CONFIG_USE_DMA is not set # CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set # end of Components Configuration CONFIG_USE_G_LIBC=y @@ -87,6 +81,7 @@ CONFIG_USE_G_LIBC=y # Cross-Compiler Setting # CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 # CONFIG_USE_EXT_COMPILER is not set # end of Cross-Compiler Setting @@ -102,7 +97,6 @@ CONFIG_LOG_INFO=y # # CONFIG_AARCH32_RAM_LD is not set CONFIG_AARCH64_RAM_LD=y -# CONFIG_QEMU_AARCH32_RAM_LD is not set # CONFIG_USER_DEFINED_LD is not set CONFIG_LINK_SCRIPT_ROM=y CONFIG_ROM_START_UP_ADDR=0x80100000 @@ -110,8 +104,8 @@ CONFIG_ROM_SIZE_MB=1 CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 -CONFIG_HEAP_SIZE=0x100000 -CONFIG_STACK_TOP_ADDR=0x82000000 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 # end of Linker Options # end of Building Option diff --git a/example/lwip_test/sdkconfig.h b/example/lwip_test/sdkconfig.h index df7a5732..294574c2 100644 --- a/example/lwip_test/sdkconfig.h +++ b/example/lwip_test/sdkconfig.h @@ -25,9 +25,9 @@ /* Board Configuration */ -#define CONFIG_TARGET_F2000_4 +/* CONFIG_TARGET_F2000_4 is not set */ /* CONFIG_TARGET_E2000 is not set */ -/* CONFIG_TARGET_D2000 is not set */ +#define CONFIG_TARGET_D2000 /* end of Board Configuration */ /* Components Configuration */ @@ -35,7 +35,7 @@ /* CONFIG_USE_SPI is not set */ /* CONFIG_USE_QSPI is not set */ #define CONFIG_USE_GIC -#define CONFIG_EBABLE_GICV3 +#define CONFIG_ENABLE_GICV3 #define CONFIG_USE_SERIAL /* Usart Configuration */ @@ -48,14 +48,8 @@ /* Eth Configuration */ -/* CONFIG_ENABLE_F_XMAC is not set */ -#define CONFIG_ENABLE_F_GMAC - -/* F_GMAC Configuration */ - -/* CONFIG_F_GMAC_PHY_COMMON is not set */ -#define CONFIG_F_GMAC_PHY_AR803X -/* end of F_GMAC Configuration */ +/* CONFIG_ENABLE_FXMAC is not set */ +/* CONFIG_ENABLE_FGMAC is not set */ /* end of Eth Configuration */ /* CONFIG_USE_CAN is not set */ /* CONFIG_USE_I2C is not set */ @@ -65,6 +59,7 @@ /* CONFIG_USE_WDT is not set */ /* CONFIG_USE_DMA is not set */ /* CONFIG_USE_NAND is not set */ +/* CONFIG_USE_RTC is not set */ /* end of Components Configuration */ #define CONFIG_USE_G_LIBC /* CONFIG_USE_NEW_LIBC is not set */ @@ -75,6 +70,7 @@ /* Cross-Compiler Setting */ #define CONFIG_COMPILER_NO_STD_STARUP +#define CONFIG_GCC_OPTIMIZE_LEVEL 0 /* CONFIG_USE_EXT_COMPILER is not set */ /* end of Cross-Compiler Setting */ /* CONFIG_LOG_VERBOS is not set */ @@ -88,7 +84,6 @@ /* CONFIG_AARCH32_RAM_LD is not set */ #define CONFIG_AARCH64_RAM_LD -/* CONFIG_QEMU_AARCH32_RAM_LD is not set */ /* CONFIG_USER_DEFINED_LD is not set */ #define CONFIG_LINK_SCRIPT_ROM #define CONFIG_ROM_START_UP_ADDR 0x80100000 @@ -96,8 +91,8 @@ #define CONFIG_LINK_SCRIPT_RAM #define CONFIG_RAM_START_UP_ADDR 0x81000000 #define CONFIG_RAM_SIZE_MB 64 -#define CONFIG_HEAP_SIZE 0x100000 -#define CONFIG_STACK_TOP_ADDR 0x82000000 +#define CONFIG_HEAP_SIZE 1 +#define CONFIG_STACK_SIZE 0x400 /* end of Linker Options */ /* end of Building Option */ diff --git a/git b/git new file mode 100644 index 0000000000000000000000000000000000000000..b60f6d1350f88a370e572d075ecba4f046a6d4ed GIT binary patch literal 20480 zcmeIuu?~YE6a`Q|g)cC?iuHRsHJwb9{(o_(Lu1m(?cC*&OCWHD=c^6vv8D@Cdgggf z`|SCdx4L&xW4ezu$`q+Y#8^@;7ryDZ`n~nv=bYAMX-9do__u#@L`8rA0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly eK!5-N0t5&UAV7cs0RjXF5FkK+009C7z5*Y@)e@fo literal 0 HcmV?d00001 diff --git a/make/complier.mk b/make/complier.mk index d470c966..f849c246 100755 --- a/make/complier.mk +++ b/make/complier.mk @@ -80,8 +80,8 @@ $(shell if [ ! -e $(OUTPUT_DIR) ];then mkdir -p $(OUTPUT_DIR); fi) include $(STANDALONE_DIR)/standalone.mk include $(STANDALONE_DIR)/lib/lib.mk include $(FREERTOS_SDK_ROOT)/make/ld.mk -include $(FREERTOS_SDK_ROOT)/standalone_adaptive.mk include $(FREERTOS_SDK_ROOT)/third-party/third-party.mk +include $(FREERTOS_SDK_ROOT)/standalone_adaptive.mk INC_DIR := $(INC_DIR) $(USR_INC_DIR) diff --git a/standalone_adaptive.mk b/standalone_adaptive.mk index f40f83ce..1225afa2 100644 --- a/standalone_adaptive.mk +++ b/standalone_adaptive.mk @@ -3,6 +3,7 @@ EXCL_SRC += $(FREERTOS_SDK_ROOT)/standalone/common/fmemory_pool.c ifdef CONFIG_TARGET_ARMV8_AARCH64 +EXCL_SRC += $(FREERTOS_SDK_ROOT)/standalone/arch/armv8/aarch64/gcc/boot.S EXCL_SRC += $(FREERTOS_SDK_ROOT)/standalone/arch/armv8/aarch64/gcc/vectors.S EXCL_SRC += $(FREERTOS_SDK_ROOT)/standalone/arch/armv8/aarch64/gcc/vectors_g.c else diff --git a/standalone_o b/standalone_o deleted file mode 160000 index 2522fab8..00000000 --- a/standalone_o +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2522fab8c06978215386c47178b09d01f893e174 diff --git a/third-party/Kconfig b/third-party/Kconfig index 0bae1131..3071d5eb 100644 --- a/third-party/Kconfig +++ b/third-party/Kconfig @@ -1,9 +1,3 @@ -# config USE_COREMARK -# bool -# depends on USE_LIBC -# prompt "Use Coremark" -# help -# Include Coremark for Benchmark config USE_LWIP bool diff --git a/third-party/freertos/portable/GCC/ft_platform/aarch64/boot.S b/third-party/freertos/portable/GCC/ft_platform/aarch64/boot.S new file mode 100644 index 00000000..39ea6c03 --- /dev/null +++ b/third-party/freertos/portable/GCC/ft_platform/aarch64/boot.S @@ -0,0 +1,126 @@ + + +.global _boot + +.global _vector_table + + +.set vector_base, _vector_table +.set el1_stack, __el1_stack + + + +.section .boot,"ax" + +_boot: + mrs x0, CurrentEL + cmp x0, 0xc + b.eq El3Entry + cmp x0, 0x8 + b.eq El2Entry + cmp x0, 0x4 + b.eq El1Entry + bne hang + El3Entry: + /* initialize sctlr_el2 and hcr_el2 to save values before entering el2.*/ + msr sctlr_el2, xzr + msr hcr_el2, xzr + /* determine the el2 execution state.*/ + mrs x0, scr_el3 + orr x0, x0, #(1<<10) + /* rw el2 execution state is aarch64.*/ + orr x0, x0, #(1<<0) + /* ns el1 is non-secure world.*/ + msr scr_el3, x0 + mov x0, #0b01001 + /* daif=0000 */ + msr spsr_el3, x0 + /* m[4:0]=01001 el2h must match scr_el3.rw*/ + + /* determine el2 entry.*/ + adr x0, El2Entry + /* El2Entry points to the first instruction of */ + msr elr_el3, x0 + /* el2 code.*/ + eret + El2Entry: + + /* initialize the sctlr_el1 register before entering el1.*/ + msr sctlr_el1, xzr + mrs x0, hcr_el2 + orr x0, x0, #(1<<31) + /* rw=1 el1 execution state is aarch64.*/ + msr hcr_el2, x0 + mov x0, #0b00101 + /* daif=0000 */ + msr spsr_el2, x0 + /* m[4:0]=00101 el1h must match hcr_el2.rw.*/ + adr x0, El1Entry + /* El1Entry points to the first instruction of */ + msr elr_el2, x0 + /* el1 code.*/ + eret + +El1Entry: +InitEl1: + mov x0, #0 + mov x1, #0 + mov x2, #0 + mov x3, #0 + mov x4, #0 + mov x5, #0 + mov x6, #0 + mov x7, #0 + mov x8, #0 + mov x9, #0 + mov x10, #0 + mov x11, #0 + mov x12, #0 + mov x13, #0 + mov x14, #0 + mov x15, #0 + mov x16, #0 + mov x17, #0 + mov x18, #0 + mov x19, #0 + mov x20, #0 + mov x21, #0 + mov x22, #0 + mov x23, #0 + mov x24, #0 + mov x25, #0 + mov x26, #0 + mov x27, #0 + mov x28, #0 + mov x29, #0 + mov x30, #0 + mov x1,#0x0 + msr SCTLR_EL1, x1 + isb + + /* Set vector table base address */ + ldr x1,=vector_base + msr VBAR_EL1,x1 + + + /* Trap floating point access only in case of standalone BSP */ + mrs x0, CPACR_EL1 + /* bic x0, x0, #(0x3 << 20) */ + orr x0, x0, #(0x3 << 20) + msr CPACR_EL1, x0 + isb + + + /* Define stack pointer for current exception level */ + ldr x2,=el1_stack + mov sp,x2 + + bl _startup /* jump to start */ + + +hang: + wfi + b HangPrint + b hang + + diff --git a/third-party/freertos/portable/GCC/ft_platform/aarch64/portASM.S b/third-party/freertos/portable/GCC/ft_platform/aarch64/portASM.S index 077ef23a..1c8b1ad0 100644 --- a/third-party/freertos/portable/GCC/ft_platform/aarch64/portASM.S +++ b/third-party/freertos/portable/GCC/ft_platform/aarch64/portASM.S @@ -32,6 +32,7 @@ .extern ullMaxAPIPriorityMask .extern pxCurrentTCB .extern vTaskSwitchContext + .extern _freertos_vector_table .extern vApplicationIRQHandler .extern ullPortInterruptNesting .extern ullPortTaskHasFPUContext @@ -257,7 +258,7 @@ FreeRTOS_Abort: .align 8 .type vPortRestoreTaskContext, %function vPortRestoreTaskContext: -.set freertos_vector_base, _vector_table +.set freertos_vector_base, _freertos_vector_table /* Install the FreeRTOS interrupt handlers. */ LDR X1, =freertos_vector_base diff --git a/third-party/freertos/portable/GCC/ft_platform/aarch64/vectors.S b/third-party/freertos/portable/GCC/ft_platform/aarch64/vectors.S index 95bcc7ec..d70bf54b 100644 --- a/third-party/freertos/portable/GCC/ft_platform/aarch64/vectors.S +++ b/third-party/freertos/portable/GCC/ft_platform/aarch64/vectors.S @@ -1,6 +1,7 @@ .globl _boot .globl _vector_table +.globl _freertos_vector_table .globl FiqInterrupt .globl IrqInterrupt @@ -113,10 +114,10 @@ _vector_table: b _boot .org (VBAR + 0x200) - b FreeRTOS_SWI_Handler + b SynchronousInterruptHandler .org (VBAR + 0x280) - b FreeRTOS_IRQ_Handler + b IRQInterruptHandler .org (VBAR + 0x300) b FIQInterruptHandler @@ -124,8 +125,7 @@ _vector_table: .org (VBAR + 0x380) b SErrorInterruptHandler -.weak SynchronousInterruptHandler -.type SynchronousInterruptHandler, %function + SynchronousInterruptHandler: SaveRegister /* Check if the Synchronous abort is occurred due to floating point access. */ @@ -182,8 +182,7 @@ RestoreContext: RestoreRegister eret -.weak IRQInterruptHandler -.type IRQInterruptHandler, %function + IRQInterruptHandler: SaveRegister /* Save the status of SPSR, ELR and CPTR to stack */ @@ -254,7 +253,62 @@ SErrorInterruptHandler: eret -.align 8 +.set FREERTOS_VBAR, (VBAR+0x2000) + +.org(FREERTOS_VBAR) +_freertos_vector_table: + b FreeRTOS_SWI_Handler + +.org (FREERTOS_VBAR + 0x80) + b FreeRTOS_IRQ_Handler + +.org (FREERTOS_VBAR + 0x100) + b . + +.org (FREERTOS_VBAR + 0x180) + b . + +.org (FREERTOS_VBAR + 0x200) + b FreeRTOS_SWI_Handler + +.org (FREERTOS_VBAR + 0x280) + b FreeRTOS_IRQ_Handler + +.org (FREERTOS_VBAR + 0x300) + b . + +.org (FREERTOS_VBAR + 0x380) + b SErrorInterruptHandler /* SError/vSError */ + +.org (FREERTOS_VBAR + 0x400) + b . + +.org (FREERTOS_VBAR + 0x480) + b . + +.org (FREERTOS_VBAR + 0x500) + b . + +.org (FREERTOS_VBAR + 0x580) + b . + +.org (FREERTOS_VBAR + 0x600) + b . + +.org (FREERTOS_VBAR + 0x680) + b . + +.org (FREERTOS_VBAR + 0x700) + b . + +.org (FREERTOS_VBAR + 0x780) + b . + +.org (FREERTOS_VBAR + 0x800) + + +.align 8 + .end \ No newline at end of file diff --git a/third-party/freertos/portable/GCC/ft_platform_o/aarch32/FreeRTOSConfig.h b/third-party/freertos/portable/GCC/ft_platform_o/aarch32/FreeRTOSConfig.h deleted file mode 100644 index 7d013424..00000000 --- a/third-party/freertos/portable/GCC/ft_platform_o/aarch32/FreeRTOSConfig.h +++ /dev/null @@ -1,250 +0,0 @@ -/* - * FreeRTOS V202011.00 - * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * http://www.FreeRTOS.org - * http://aws.amazon.com/freertos - * - * 1 tab == 4 spaces! - */ - -#ifndef FREERTOS_CONFIG_H -#define FREERTOS_CONFIG_H - -/*----------------------------------------------------------- - * Application specific definitions. - * - * These definitions should be adjusted for your particular hardware and - * application requirements. - * - * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE - * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. - * - * See http://www.freertos.org/a00110.html - *----------------------------------------------------------*/ - -/* - * The FreeRTOS Cortex-A port implements a full interrupt nesting model. - * - * Interrupts that are assigned a priority at or below - * configMAX_API_CALL_INTERRUPT_PRIORITY (which counter-intuitively in the ARM - * generic interrupt controller [GIC] means a priority that has a numerical - * value above configMAX_API_CALL_INTERRUPT_PRIORITY) can call FreeRTOS safe API - * functions and will nest. - * - * Interrupts that are assigned a priority above - * configMAX_API_CALL_INTERRUPT_PRIORITY (which in the GIC means a numerical - * value below configMAX_API_CALL_INTERRUPT_PRIORITY) cannot call any FreeRTOS - * API functions, will nest, and will not be masked by FreeRTOS critical - * sections (although it is necessary for interrupts to be globally disabled - * extremely briefly as the interrupt mask is updated in the GIC). - * - * FreeRTOS functions that can be called from an interrupt are those that end in - * "FromISR". FreeRTOS maintains a separate interrupt safe API to enable - * interrupt entry to be shorter, faster, simpler and smaller. - * - */ - -/* 在不安全group1 中 ,0x8 ~0xb 不可以使用安全api(优先级越低越高)*/ -#define configMAX_API_CALL_INTERRUPT_PRIORITY 0xb -/* 在不安全group1 中,16 is steps ,3 是其中等级*/ -#define configKERNEL_INTERRUPT_PRIORITY ((0x8 << 4) + 3 * 16) - - -#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 //Method to select the next task -#define configUSE_TICKLESS_IDLE 0 //disable tickless mode -#define configTICK_RATE_HZ ((TickType_t)1000) //system timer rate 10ms -#define configUSE_PREEMPTION 1 //preemption task -#define configUSE_IDLE_HOOK 1 -#define configUSE_TICK_HOOK 1 -#define configMAX_PRIORITIES (7) -#define configMINIMAL_STACK_SIZE ((unsigned short)1024) //min task stack size 100*4 bytes -#define configTOTAL_HEAP_SIZE (4096 * 1024) //total heap size -#define configMAX_TASK_NAME_LEN (20) -#define configUSE_TRACE_FACILITY 1 //启用可视化跟踪调试 -/* 与宏 configUSE_TRACE_FACILITY 同时为 1 时会编译下面 3 个函数 -* prvWriteNameToBuffer() -* vTaskList(), -* vTaskGetRunTimeStats() -*/ -#define configUSE_16_BIT_TICKS 0 //use 32 bit ticktype -#define configIDLE_SHOULD_YIELD 1 //idle task would not yield for task with same priority -#define configUSE_MUTEXES 1 -#define configQUEUE_REGISTRY_SIZE 8 //max queue and semp member -#define configCHECK_FOR_STACK_OVERFLOW 0 -#define configUSE_RECURSIVE_MUTEXES 1 -#define configUSE_MALLOC_FAILED_HOOK 1 -#define configUSE_APPLICATION_TASK_TAG 0 -#define configUSE_COUNTING_SEMAPHORES 1 -#define configUSE_QUEUE_SETS 1 -#define configSUPPORT_STATIC_ALLOCATION 1 //use dynamic memory allocation -#define configSUPPORT_DYNAMIC_ALLOCATION 1 - -/* Include the query-heap CLI command to query the free heap space. */ -#define configINCLUDE_QUERY_HEAP_COMMAND 1 - -/* Co-routine definitions. */ -#define configUSE_CO_ROUTINES 0 //disable co-routines -#define configMAX_CO_ROUTINE_PRIORITIES (2) - -/* Software timer definitions. */ -#define configUSE_TIMERS 1 //use software timer -#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 1) -#define configTIMER_QUEUE_LENGTH 5 -#define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE * 2) - -/* If configUSE_TASK_FPU_SUPPORT is set to 1 (or undefined) then each task will -be created without an FPU context, and a task must call vTaskUsesFPU() before -making use of any FPU registers. If configUSE_TASK_FPU_SUPPORT is set to 2 then -tasks are created with an FPU context by default, and calling vTaskUsesFPU() has -no effect. */ -#define configUSE_TASK_FPU_SUPPORT 1 - -/* Set the following definitions to 1 to include the API function, or zero -to exclude the API function. */ -#define INCLUDE_vTaskPrioritySet 1 -#define INCLUDE_uxTaskPriorityGet 1 -#define INCLUDE_vTaskDelete 1 -#define INCLUDE_vTaskCleanUpResources 1 -#define INCLUDE_vTaskSuspend 1 -#define INCLUDE_vTaskDelayUntil 1 -#define INCLUDE_vTaskDelay 1 -#define INCLUDE_xTimerPendFunctionCall 1 -#define INCLUDE_eTaskGetState 1 -#define INCLUDE_xTaskAbortDelay 1 -#define INCLUDE_xTaskGetTaskHandle 1 -#define INCLUDE_xTaskGetHandle 1 - -#define INCLUDE_xSemaphoreGetMutexHolder 1 -#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 5 -#define INCLUDE_xTaskGetIdleTaskHandle 1 - -/* This demo makes use of one or more example stats formatting functions. These -format the raw data provided by the uxTaskGetSystemState() function in to human -readable ASCII form. See the notes in the implementation of vTaskList() within -FreeRTOS/Source/tasks.c for limitations. */ -#define configUSE_STATS_FORMATTING_FUNCTIONS 1 - -/* Run time stats are not generated. portCONFIGURE_TIMER_FOR_RUN_TIME_STATS and -portGET_RUN_TIME_COUNTER_VALUE must be defined if configGENERATE_RUN_TIME_STATS -is set to 1. */ -#define configGENERATE_RUN_TIME_STATS 1 //启用运行时间统计功能 -#ifndef __ASSEMBLER__ // skip when preprocess asm -extern volatile unsigned int gCpuRuntime; -#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() (gCpuRuntime = 0ul) -#define portGET_RUN_TIME_COUNTER_VALUE() gCpuRuntime -#endif - -/* The size of the global output buffer that is available for use when there -are multiple command interpreters running at once (for example, one on a UART -and one on TCP/IP). This is done to prevent an output buffer being defined by -each implementation - which would waste RAM. In this case, there is only one -command interpreter running. */ -#define configCOMMAND_INT_MAX_OUTPUT_SIZE 2096 - -/* Normal assert() semantics without relying on the provision of an assert.h -header file. */ - -#define configASSERT(x) \ - do \ - { \ - void vMainAssertCalled(const char *pcFileName, uint32_t ulLineNumber);\ - if ((x) == 0) \ - { \ - vMainAssertCalled(__FILE__, __LINE__);\ - } \ - } while (0); - - -/* If configTASK_RETURN_ADDRESS is not defined then a task that attempts to -return from its implementing function will end up in a "task exit error" -function - which contains a call to configASSERT(). However this can give GCC -some problems when it tries to unwind the stack, as the exit error function has -nothing to return to. To avoid this define configTASK_RETURN_ADDRESS to 0. */ -#define configTASK_RETURN_ADDRESS NULL - -/****** Hardware specific settings. *******************************************/ - -/* - * The application must provide a function that configures a peripheral to - * create the FreeRTOS tick interrupt, then define configSETUP_TICK_INTERRUPT() - * in FreeRTOSConfig.h to call the function. FreeRTOS_Tick_Handler() must - * be installed as the peripheral's interrupt handler. - */ - - -#define configSETUP_TICK_INTERRUPT() \ - do \ - { \ - void vConfigureTickInterrupt(void);\ - vConfigureTickInterrupt(); \ - } while (0) - - -#define configCLEAR_TICK_INTERRUPT() \ - do \ - { \ - void vClearTickInterrupt(void);\ - vClearTickInterrupt(); \ - }while (0) - -#define FreeRTOS_IRQ_Handler IRQ_Handler -#define FreeRTOS_SWI_Handler SWI_Handler - -#define configINTERRUPT_CONTROLLER_BASE_ADDRESS (0x71800000) -#define configINTERRUPT_CONTROLLER_CPU_INTERFACE_OFFSET (0x2000UL) -#define configUNIQUE_INTERRUPT_PRIORITIES 16 - -/****** Network configuration settings - only used when the lwIP example is -built. See the page that documents this demo on the http://www.FreeRTOS.org -website for more information. ***********************************************/ - -/* The priority for the task that unblocked by the MAC interrupt to process -received packets. */ -#define configMAC_INPUT_TASK_PRIORITY (configMAX_PRIORITIES - 1) - -/* The priority of the task that runs the lwIP stack. */ -#define configLWIP_TASK_PRIORITY (configMAX_PRIORITIES - 2) - -/* The priority of the task that uses lwIP sockets to provide a simple command -line interface. */ -#define configCLI_TASK_PRIORITY (tskIDLE_PRIORITY) - -/* MAC address configuration. */ -#define configMAC_ADDR0 0x00 -#define configMAC_ADDR1 0x13 -#define configMAC_ADDR2 0x14 -#define configMAC_ADDR3 0x15 -#define configMAC_ADDR4 0x15 -#define configMAC_ADDR5 0x16 - -/* IP address configuration. */ -#define configIP_ADDR0 172 -#define configIP_ADDR1 25 -#define configIP_ADDR2 218 -#define configIP_ADDR3 200 - -/* Netmask configuration. */ -#define configNET_MASK0 255 -#define configNET_MASK1 255 -#define configNET_MASK2 255 -#define configNET_MASK3 0 - -#endif /* FREERTOS_CONFIG_H */ diff --git a/third-party/freertos/portable/GCC/ft_platform_o/aarch32/port.c b/third-party/freertos/portable/GCC/ft_platform_o/aarch32/port.c deleted file mode 100644 index 74582106..00000000 --- a/third-party/freertos/portable/GCC/ft_platform_o/aarch32/port.c +++ /dev/null @@ -1,554 +0,0 @@ -/* - * FreeRTOS Kernel V10.4.2 - * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS - * - * 1 tab == 4 spaces! - */ - -/* Standard includes. */ -#include -#include -#include "aarch32.h" - -/* Scheduler includes. */ -#include "FreeRTOS.h" -#include "task.h" - -#ifndef configINTERRUPT_CONTROLLER_BASE_ADDRESS -#error configINTERRUPT_CONTROLLER_BASE_ADDRESS must be defined. See https://www.FreeRTOS.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html -#endif - -#ifndef configINTERRUPT_CONTROLLER_CPU_INTERFACE_OFFSET -#error configINTERRUPT_CONTROLLER_CPU_INTERFACE_OFFSET must be defined. See https://www.FreeRTOS.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html -#endif - -#ifndef configUNIQUE_INTERRUPT_PRIORITIES -#error configUNIQUE_INTERRUPT_PRIORITIES must be defined. See https://www.FreeRTOS.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html -#endif - -#ifndef configSETUP_TICK_INTERRUPT -#error configSETUP_TICK_INTERRUPT() must be defined. See https://www.FreeRTOS.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html -#endif /* configSETUP_TICK_INTERRUPT */ - -#ifndef configMAX_API_CALL_INTERRUPT_PRIORITY -#error configMAX_API_CALL_INTERRUPT_PRIORITY must be defined. See https://www.FreeRTOS.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html -#endif - -#if configMAX_API_CALL_INTERRUPT_PRIORITY == 0 -#error configMAX_API_CALL_INTERRUPT_PRIORITY must not be set to 0 -#endif - -#if configMAX_API_CALL_INTERRUPT_PRIORITY > configUNIQUE_INTERRUPT_PRIORITIES -#error configMAX_API_CALL_INTERRUPT_PRIORITY must be less than or equal to configUNIQUE_INTERRUPT_PRIORITIES as the lower the numeric priority value the higher the logical interrupt priority -#endif - -#if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1 -/* Check the configuration. */ -#if (configMAX_PRIORITIES > 32) -#error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 difference priorities as tasks that share a priority will time slice. -#endif -#endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */ - -/* In case security extensions are implemented. */ -#if configMAX_API_CALL_INTERRUPT_PRIORITY <= (configUNIQUE_INTERRUPT_PRIORITIES / 2) -#error configMAX_API_CALL_INTERRUPT_PRIORITY must be greater than ( configUNIQUE_INTERRUPT_PRIORITIES / 2 ) -#endif - -/* Some vendor specific files default configCLEAR_TICK_INTERRUPT() in -portmacro.h. */ -#ifndef configCLEAR_TICK_INTERRUPT -#define configCLEAR_TICK_INTERRUPT() -#endif - -/* A critical section is exited when the critical section nesting count reaches -this value. */ -#define portNO_CRITICAL_NESTING ((uint32_t)0) - -/* In all GICs 255 can be written to the priority mask register to unmask all -(but the lowest) interrupt priority. */ -#define portUNMASK_VALUE (0xF0UL) - -/* Tasks are not created with a floating point context, but can be given a -floating point context after they have been created. A variable is stored as -part of the tasks context that holds portNO_FLOATING_POINT_CONTEXT if the task -does not have an FPU context, or any other value if the task does have an FPU -context. */ -#define portNO_FLOATING_POINT_CONTEXT ((StackType_t)0) - -/* Constants required to setup the initial task context. */ -#define portINITIAL_SPSR ((StackType_t)0x1f) /* System mode, ARM mode, IRQ enabled FIQ enabled. */ -#define portTHUMB_MODE_BIT ((StackType_t)0x20) -#define portINTERRUPT_ENABLE_BIT (0x80UL) -#define portTHUMB_MODE_ADDRESS (0x01UL) - -/* Used by portASSERT_IF_INTERRUPT_PRIORITY_INVALID() when ensuring the binary -point is zero. */ -#define portBINARY_POINT_BITS ((uint8_t)0x03) - -/* Masks all bits in the APSR other than the mode bits. */ -#define portAPSR_MODE_BITS_MASK (0x1F) - -/* The value of the mode bits in the APSR when the CPU is executing in user -mode. */ -#define portAPSR_USER_MODE (0x10) - -/* The critical section macros only mask interrupts up to an application -determined priority level. Sometimes it is necessary to turn interrupt off in -the CPU itself before modifying certain hardware registers. */ -#define portCPU_IRQ_DISABLE() \ - __asm volatile("CPSID i" :: \ - : "memory"); \ - __asm volatile("DSB"); \ - __asm volatile("ISB"); - -#define portCPU_IRQ_ENABLE() \ - __asm volatile("CPSIE i" :: \ - : "memory"); \ - __asm volatile("DSB"); \ - __asm volatile("ISB"); - -/* Macro to unmask all interrupt priorities. */ -#define portCLEAR_INTERRUPT_MASK() \ - { \ - portCPU_IRQ_DISABLE(); \ - sys_icc_pmr_set(portUNMASK_VALUE); \ - __asm volatile("DSB \n" \ - "ISB \n"); \ - portCPU_IRQ_ENABLE(); \ - } - -/* Hardware specifics used when sanity checking the configuration. */ -#define portINTERRUPT_PRIORITY_REGISTER_OFFSET (0x400UL + 32UL) // -#define portMAX_8_BIT_VALUE ((uint8_t)0xff) -#define portBIT_0_SET ((uint8_t)0x01) - -/* Let the user override the pre-loading of the initial LR with the address of -prvTaskExitError() in case it messes up unwinding of the stack in the -debugger. */ -#ifdef configTASK_RETURN_ADDRESS -#define portTASK_RETURN_ADDRESS configTASK_RETURN_ADDRESS -#else -#define portTASK_RETURN_ADDRESS prvTaskExitError -#endif - -/* The space on the stack required to hold the FPU registers. This is 32 64-bit -registers, plus a 32-bit status register. */ -#define portFPU_REGISTER_WORDS ((32 * 2) + 1) - -/*-----------------------------------------------------------*/ - -/* - * Starts the first task executing. This function is necessarily written in - * assembly code so is implemented in portASM.s. - */ -extern void vPortRestoreTaskContext(void); - -/* - * Used to catch tasks that attempt to return from their implementing function. - */ -static void prvTaskExitError(void); - -/* - * If the application provides an implementation of vApplicationIRQHandler(), - * then it will get called directly without saving the FPU registers on - * interrupt entry, and this weak implementation of - * vApplicationFPUSafeIRQHandler() is just provided to remove linkage errors - - * it should never actually get called so its implementation contains a - * call to configASSERT() that will always fail. - * - * If the application provides its own implementation of - * vApplicationFPUSafeIRQHandler() then the implementation of - * vApplicationIRQHandler() provided in portASM.S will save the FPU registers - * before calling it. - * - * Therefore, if the application writer wants FPU registers to be saved on - * interrupt entry their IRQ handler must be called - * vApplicationFPUSafeIRQHandler(), and if the application writer does not want - * FPU registers to be saved on interrupt entry their IRQ handler must be - * called vApplicationIRQHandler(). - */ -void vApplicationFPUSafeIRQHandler(uint32_t ulICCIAR) __attribute__((weak)); - -/*-----------------------------------------------------------*/ - -/* A variable is used to keep track of the critical section nesting. This -variable has to be stored as part of the task context and must be initialised to -a non zero value to ensure interrupts don't inadvertently become unmasked before -the scheduler starts. As it is stored as part of the task context it will -automatically be set to 0 when the first task is started. */ -volatile uint32_t ulCriticalNesting = 9999UL; - -/* Saved as part of the task context. If ulPortTaskHasFPUContext is non-zero then -a floating point context must be saved and restored for the task. */ -volatile uint32_t ulPortTaskHasFPUContext = pdFALSE; - -/* Set to 1 to pend a context switch from an ISR. */ -volatile uint32_t ulPortYieldRequired = pdFALSE; - -/* Counts the interrupt nesting depth. A context switch is only performed if -if the nesting depth is 0. */ -volatile uint32_t ulPortInterruptNesting = 0UL; - -/* Used in the asm file. */ -// __attribute__((used)) const uint32_t ulICCIAR = portICCIAR_INTERRUPT_ACKNOWLEDGE_REGISTER_ADDRESS; -// __attribute__((used)) const uint32_t ulICCEOIR = portICCEOIR_END_OF_INTERRUPT_REGISTER_ADDRESS; -// __attribute__((used)) const uint32_t ulICCPMR = portICCPMR_PRIORITY_MASK_REGISTER_ADDRESS; -__attribute__((used)) const uint32_t ulMaxAPIPriorityMask = (configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT); - -/*-----------------------------------------------------------*/ - -/* - * See header file for description. - */ -StackType_t *pxPortInitialiseStack(StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters) -{ - /* Setup the initial stack of the task. The stack is set exactly as - expected by the portRESTORE_CONTEXT() macro. - - The fist real value on the stack is the status register, which is set for - system mode, with interrupts enabled. A few NULLs are added first to ensure - GDB does not try decoding a non-existent return address. */ - *pxTopOfStack = (StackType_t)NULL; - pxTopOfStack--; - *pxTopOfStack = (StackType_t)NULL; - pxTopOfStack--; - *pxTopOfStack = (StackType_t)NULL; - pxTopOfStack--; - *pxTopOfStack = (StackType_t)portINITIAL_SPSR; - - if (((uint32_t)pxCode & portTHUMB_MODE_ADDRESS) != 0x00UL) - { - /* The task will start in THUMB mode. */ - *pxTopOfStack |= portTHUMB_MODE_BIT; - } - - pxTopOfStack--; - - /* Next the return address, which in this case is the start of the task. */ - *pxTopOfStack = (StackType_t)pxCode; - pxTopOfStack--; - - /* Next all the registers other than the stack pointer. */ - *pxTopOfStack = (StackType_t)portTASK_RETURN_ADDRESS; /* R14 */ - pxTopOfStack--; - *pxTopOfStack = (StackType_t)0x12121212; /* R12 */ - pxTopOfStack--; - *pxTopOfStack = (StackType_t)0x11111111; /* R11 */ - pxTopOfStack--; - *pxTopOfStack = (StackType_t)0x10101010; /* R10 */ - pxTopOfStack--; - *pxTopOfStack = (StackType_t)0x09090909; /* R9 */ - pxTopOfStack--; - *pxTopOfStack = (StackType_t)0x08080808; /* R8 */ - pxTopOfStack--; - *pxTopOfStack = (StackType_t)0x07070707; /* R7 */ - pxTopOfStack--; - *pxTopOfStack = (StackType_t)0x06060606; /* R6 */ - pxTopOfStack--; - *pxTopOfStack = (StackType_t)0x05050505; /* R5 */ - pxTopOfStack--; - *pxTopOfStack = (StackType_t)0x04040404; /* R4 */ - pxTopOfStack--; - *pxTopOfStack = (StackType_t)0x03030303; /* R3 */ - pxTopOfStack--; - *pxTopOfStack = (StackType_t)0x02020202; /* R2 */ - pxTopOfStack--; - *pxTopOfStack = (StackType_t)0x01010101; /* R1 */ - pxTopOfStack--; - *pxTopOfStack = (StackType_t)pvParameters; /* R0 */ - pxTopOfStack--; - - /* The task will start with a critical nesting count of 0 as interrupts are - enabled. */ - *pxTopOfStack = portNO_CRITICAL_NESTING; - -#if (configUSE_TASK_FPU_SUPPORT == 1) - { - /* The task will start without a floating point context. A task that - uses the floating point hardware must call vPortTaskUsesFPU() before - executing any floating point instructions. */ - pxTopOfStack--; - *pxTopOfStack = portNO_FLOATING_POINT_CONTEXT; - } -#elif (configUSE_TASK_FPU_SUPPORT == 2) - { - /* The task will start with a floating point context. Leave enough - space for the registers - and ensure they are initialised to 0. */ - pxTopOfStack -= portFPU_REGISTER_WORDS; - memset(pxTopOfStack, 0x00, portFPU_REGISTER_WORDS * sizeof(StackType_t)); - - pxTopOfStack--; - *pxTopOfStack = pdTRUE; - ulPortTaskHasFPUContext = pdTRUE; - } -#else - { -#error Invalid configUSE_TASK_FPU_SUPPORT setting - configUSE_TASK_FPU_SUPPORT must be set to 1, 2, or left undefined. - } -#endif - - return pxTopOfStack; -} -/*-----------------------------------------------------------*/ - -static void prvTaskExitError(void) -{ - /* A function that implements a task must not exit or attempt to return to - its caller as there is nothing to return to. If a task wants to exit it - should instead call vTaskDelete( NULL ). - - Artificially force an assert() to be triggered if configASSERT() is - defined, then stop here so application writers can catch the error. */ - configASSERT(ulPortInterruptNesting == ~0UL); - portDISABLE_INTERRUPTS(); - for (;;) - ; -} -/*-----------------------------------------------------------*/ - -BaseType_t xPortStartScheduler(void) -{ - uint32_t ulAPSR; - - /* Only continue if the CPU is not in User mode. The CPU must be in a - Privileged mode for the scheduler to start. */ - __asm volatile("MRS %0, APSR" - : "=r"(ulAPSR)::"memory"); - - ulAPSR &= portAPSR_MODE_BITS_MASK; - - configASSERT(ulAPSR != portAPSR_USER_MODE); - - if (ulAPSR != portAPSR_USER_MODE) - { - /* Only continue if the binary point value is set to its lowest possible - setting. See the comments in vPortValidateInterruptPriority() below for - more information. */ - - configASSERT((sys_icc_bpr_get() & portBINARY_POINT_BITS) <= portMAX_BINARY_POINT_VALUE); - - if ((sys_icc_bpr_get() & portBINARY_POINT_BITS) <= portMAX_BINARY_POINT_VALUE) - { - /* Interrupts are turned off in the CPU itself to ensure tick does - not execute while the scheduler is being started. Interrupts are - automatically turned back on in the CPU when the first task starts - executing. */ - portCPU_IRQ_DISABLE(); - - /* Start the timer that generates the tick ISR. */ - configSETUP_TICK_INTERRUPT(); - - /* Start the first task executing. */ - vPortRestoreTaskContext(); - } - } - - /* Will only get here if vTaskStartScheduler() was called with the CPU in - a non-privileged mode or the binary point register was not set to its lowest - possible value. prvTaskExitError() is referenced to prevent a compiler - warning about it being defined but not referenced in the case that the user - defines their own exit address. */ - (void)prvTaskExitError; - return 0; -} -/*-----------------------------------------------------------*/ - -void vPortEndScheduler(void) -{ - /* Not implemented in ports where there is nothing to return to. - Artificially force an assert. */ - configASSERT(ulCriticalNesting == 1000UL); -} -/*-----------------------------------------------------------*/ - -void vPortEnterCritical(void) -{ - /* Mask interrupts up to the max syscall interrupt priority. */ - ulPortSetInterruptMask(); - - /* Now interrupts are disabled ulCriticalNesting can be accessed - directly. Increment ulCriticalNesting to keep a count of how many times - portENTER_CRITICAL() has been called. */ - ulCriticalNesting++; - - /* This is not the interrupt safe version of the enter critical function so - assert() if it is being called from an interrupt context. Only API - functions that end in "FromISR" can be used in an interrupt. Only assert if - the critical nesting count is 1 to protect against recursive calls if the - assert function also uses a critical section. */ - if (ulCriticalNesting == 1) - { - configASSERT(ulPortInterruptNesting == 0); - } -} -/*-----------------------------------------------------------*/ - -void vPortExitCritical(void) -{ - if (ulCriticalNesting > portNO_CRITICAL_NESTING) - { - /* Decrement the nesting count as the critical section is being - exited. */ - ulCriticalNesting--; - - /* If the nesting level has reached zero then all interrupt - priorities must be re-enabled. */ - if (ulCriticalNesting == portNO_CRITICAL_NESTING) - { - /* Critical nesting has reached zero so all interrupt priorities - should be unmasked. */ - portCLEAR_INTERRUPT_MASK(); - } - } -} -/*-----------------------------------------------------------*/ - -void FreeRTOS_Tick_Handler(void) -{ - /* Set interrupt mask before altering scheduler structures. The tick - handler runs at the lowest priority, so interrupts cannot already be masked, - so there is no need to save and restore the current mask value. It is - necessary to turn off interrupts in the CPU itself while the ICCPMR is being - updated. */ - portCPU_IRQ_DISABLE(); - sys_icc_pmr_set((uint32_t)(configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT)); - // portICCPMR_PRIORITY_MASK_REGISTER = (uint32_t)(configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT); - __asm volatile("dsb \n" - "isb \n" :: - : "memory"); - portCPU_IRQ_ENABLE(); - /* Increment the RTOS tick. */ - if (xTaskIncrementTick() != pdFALSE) - { - ulPortYieldRequired = pdTRUE; - } - - /* Ensure all interrupt priorities are active again. */ - portCLEAR_INTERRUPT_MASK(); - configCLEAR_TICK_INTERRUPT(); -} -/*-----------------------------------------------------------*/ - -#if (configUSE_TASK_FPU_SUPPORT != 2) - -void vPortTaskUsesFPU(void) -{ - uint32_t ulInitialFPSCR = 0; - - /* A task is registering the fact that it needs an FPU context. Set the - FPU flag (which is saved as part of the task context). */ - ulPortTaskHasFPUContext = pdTRUE; - - /* Initialise the floating point status register. */ - __asm volatile("FMXR FPSCR, %0" ::"r"(ulInitialFPSCR) - : "memory"); -} - -#endif /* configUSE_TASK_FPU_SUPPORT */ -/*-----------------------------------------------------------*/ - -void vPortClearInterruptMask(uint32_t ulNewMaskValue) -{ - if (ulNewMaskValue == pdFALSE) - { - portCLEAR_INTERRUPT_MASK(); - } -} -/*-----------------------------------------------------------*/ - -uint32_t ulPortSetInterruptMask(void) -{ - uint32_t ulReturn; - - /* Interrupt in the CPU must be turned off while the ICCPMR is being - updated. */ - portCPU_IRQ_DISABLE(); - if (sys_icc_pmr_get() == (uint32_t)(configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT)) - { - /* Interrupts were already masked. */ - ulReturn = pdTRUE; - } - else - { - ulReturn = pdFALSE; - sys_icc_pmr_set((uint32_t)(configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT)); - // portICCPMR_PRIORITY_MASK_REGISTER = (uint32_t)(configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT); - __asm volatile("dsb \n" - "isb \n" :: - : "memory"); - } - portCPU_IRQ_ENABLE(); - - return ulReturn; -} -/*-----------------------------------------------------------*/ - -#if (configASSERT_DEFINED == 1) - -void vPortValidateInterruptPriority(void) -{ - /* The following assertion will fail if a service routine (ISR) for - an interrupt that has been assigned a priority above - configMAX_SYSCALL_INTERRUPT_PRIORITY calls an ISR safe FreeRTOS API - function. ISR safe FreeRTOS API functions must *only* be called - from interrupts that have been assigned a priority at or below - configMAX_SYSCALL_INTERRUPT_PRIORITY. - - Numerically low interrupt priority numbers represent logically high - interrupt priorities, therefore the priority of the interrupt must - be set to a value equal to or numerically *higher* than - configMAX_SYSCALL_INTERRUPT_PRIORITY. - - FreeRTOS maintains separate thread and ISR API functions to ensure - interrupt entry is as fast and simple as possible. */ - configASSERT(sys_icc_rpr_get() >= (uint32_t)(configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT)); - - /* Priority grouping: The interrupt controller (GIC) allows the bits - that define each interrupt's priority to be split between bits that - define the interrupt's pre-emption priority bits and bits that define - the interrupt's sub-priority. For simplicity all bits must be defined - to be pre-emption priority bits. The following assertion will fail if - this is not the case (if some bits represent a sub-priority). - - The priority grouping is configured by the GIC's binary point register - (ICCBPR). Writting 0 to ICCBPR will ensure it is set to its lowest - possible value (which may be above 0). */ - configASSERT((sys_icc_bpr_get() & portBINARY_POINT_BITS) <= portMAX_BINARY_POINT_VALUE); -} - -#endif /* configASSERT_DEFINED */ -/*-----------------------------------------------------------*/ - -void vApplicationFPUSafeIRQHandler(uint32_t ulICCIAR) -{ - (void)ulICCIAR; - configASSERT((volatile void *)NULL); -} - -_WEAK void vApplicationTickHook(void) -{ -} - -_WEAK void vApplicationIdleHook(void) -{ -} \ No newline at end of file diff --git a/third-party/freertos/portable/GCC/ft_platform_o/aarch32/portASM.S b/third-party/freertos/portable/GCC/ft_platform_o/aarch32/portASM.S deleted file mode 100644 index 4cdbf8e8..00000000 --- a/third-party/freertos/portable/GCC/ft_platform_o/aarch32/portASM.S +++ /dev/null @@ -1,339 +0,0 @@ -/* - * FreeRTOS Kernel V10.4.2 - * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS - * - * 1 tab == 4 spaces! - */ - #include "FreeRTOSConfig.h" - - .eabi_attribute Tag_ABI_align_preserved, 1 - .text - .arm - - .set SYS_MODE, 0x1f - .set SVC_MODE, 0x13 - .set IRQ_MODE, 0x12 - - /* Hardware registers. */ - - /* Variables and functions. */ - .extern ulMaxAPIPriorityMask - .extern _freertos_vector_table - .extern pxCurrentTCB - .extern vTaskSwitchContext - .extern vApplicationIRQHandler - .extern ulPortInterruptNesting - .extern ulPortTaskHasFPUContext - - .global FreeRTOS_IRQ_Handler - .global FreeRTOS_SWI_Handler - .global vPortRestoreTaskContext - - -.macro portSAVE_CONTEXT - - /* Save the LR and SPSR onto the system mode stack before switching to - system mode to save the remaining system mode registers. */ - SRSDB sp!, #SYS_MODE - CPS #SYS_MODE - PUSH {R0-R12, R14} - - /* Push the critical nesting count. */ - LDR R2, ulCriticalNestingConst - LDR R1, [R2] - PUSH {R1} - - /* Does the task have a floating point context that needs saving? If - ulPortTaskHasFPUContext is 0 then no. */ - LDR R2, ulPortTaskHasFPUContextConst - LDR R3, [R2] - CMP R3, #0 - - /* Save the floating point context, if any. */ - FMRXNE R1, FPSCR - VPUSHNE {D0-D15} - VPUSHNE {D16-D31} - PUSHNE {R1} - - - /* Save ulPortTaskHasFPUContext itself. */ - PUSH {R3} - - - /* Save the stack pointer in the TCB. */ - LDR R0, pxCurrentTCBConst - LDR R1, [R0] - STR SP, [R1] - - .endm - -; /**********************************************************************/ - -.macro portRESTORE_CONTEXT - /* Set the SP to point to the stack of the task being restored. */ - LDR R0, pxCurrentTCBConst - LDR R1, [R0] - LDR SP, [R1] - - /* Is there a floating point context to restore? If the restored - ulPortTaskHasFPUContext is zero then no. */ - LDR R0, ulPortTaskHasFPUContextConst - POP {R1} - STR R1, [R0] - CMP R1, #0 - - - /* Restore the floating point context, if any. */ - POPNE {R0} - VPOPNE {D16-D31} - VPOPNE {D0-D15} - VMSRNE FPSCR, R0 - - - /* Restore the critical section nesting depth. */ - LDR R0, ulCriticalNestingConst - POP {R1} - STR R1, [R0] - - - /* Ensure the priority mask is correct for the critical nesting depth. */ - - CMP R1, #0 - MOVEQ R4, #255 - LDRNE R4, ulMaxAPIPriorityMaskConst - LDRNE R4, [R4] - MCR P15, 0, R4, C4, C6, 0 - ISB - - - /* Restore all system mode registers other than the SP (which is already - being used). */ - POP {R0-R12, R14} - - /* Return to the task code, loading CPSR on the way. */ - RFEIA sp! - - .endm - - - - -/****************************************************************************** - * SVC handler is used to start the scheduler. - *****************************************************************************/ -.align 4 -.type FreeRTOS_SWI_Handler, %function -FreeRTOS_SWI_Handler: - /* Save the context of the current task and select a new task to run. */ - portSAVE_CONTEXT - LDR R0, vTaskSwitchContextConst - BLX R0 - portRESTORE_CONTEXT - - -/****************************************************************************** - * vPortRestoreTaskContext is used to start the scheduler. - *****************************************************************************/ -.type vPortRestoreTaskContext, %function -vPortRestoreTaskContext: - /* Switch to system mode. */ - CPS #SYS_MODE - portRESTORE_CONTEXT - -.align 4 -.type FreeRTOS_IRQ_Handler, %function -FreeRTOS_IRQ_Handler: - /* Return to the interrupted instruction. */ - SUB lr, lr, #4 - - /* Push the return address and SPSR. */ - PUSH {lr} - MRS lr, SPSR - PUSH {lr} - - /* Change to supervisor mode to allow reentry. */ - CPS #SVC_MODE - - /* Push used registers. */ - PUSH {r0-r4, r12} - - /* Increment nesting count. r3 holds the address of ulPortInterruptNesting - for future use. r1 holds the original ulPortInterruptNesting value for - future use. */ - LDR r3, ulPortInterruptNestingConst - LDR r1, [r3] - ADD r4, r1, #1 - STR r4, [r3] - - /* Read value from the interrupt acknowledge register, which is stored in r0 - for future parameter and interrupt clearing use. */ - - mrc p15, 0, r0, c12, c12, 0 - isb - - /* Ensure bit 2 of the stack pointer is clear. r2 holds the bit 2 value for - future use. _RB_ Does this ever actually need to be done provided the start - of the stack is 8-byte aligned? */ - MOV r2, sp - AND r2, r2, #4 - SUB sp, sp, r2 - - /* Call the interrupt handler. r4 pushed to maintain alignment. */ - PUSH {r0-r4, lr} - LDR r1, vApplicationIRQHandlerConst - BLX r1 - POP {r0-r4, lr} - ADD sp, sp, r2 - - CPSID i - DSB - ISB - - /* Write the value read from ICCIAR to ICCEOIR.*/ - - mcr p15, 0, r0, c12, c12, 1 - isb - - /* Restore the old nesting count. */ - STR r1, [r3] - - /* A context switch is never performed if the nesting count is not 0. */ - CMP r1, #0 - BNE exit_without_switch - - /* Did the interrupt request a context switch? r1 holds the address of - ulPortYieldRequired and r0 the value of ulPortYieldRequired for future - use. */ - LDR r1, =ulPortYieldRequired - LDR r0, [r1] - CMP r0, #0 - BNE switch_before_exit - -exit_without_switch: - /* No context switch. Restore used registers, LR_irq and SPSR before - returning. */ - POP {r0-r4, r12} - CPS #IRQ_MODE - POP {LR} - MSR SPSR_cxsf, LR - POP {LR} - MOVS PC, LR - -switch_before_exit: - /* A context swtich is to be performed. Clear the context switch pending - flag. */ - MOV r0, #0 - STR r0, [r1] - - /* Restore used registers, LR-irq and SPSR before saving the context - to the task stack. */ - POP {r0-r4, r12} - CPS #IRQ_MODE - POP {LR} - MSR SPSR_cxsf, LR - POP {LR} - portSAVE_CONTEXT - - /* Call the function that selects the new task to execute. - vTaskSwitchContext() if vTaskSwitchContext() uses LDRD or STRD - instructions, or 8 byte aligned stack allocated data. LR does not need - saving as a new LR will be loaded by portRESTORE_CONTEXT anyway. */ - LDR R0, vTaskSwitchContextConst - BLX R0 - - /* Restore the context of, and branch to, the task selected to execute - next. */ - portRESTORE_CONTEXT - -/****************************************************************************** - * If the application provides an implementation of vApplicationIRQHandler(), - * then it will get called directly without saving the FPU registers on - * interrupt entry, and this weak implementation of - * vApplicationIRQHandler() will not get called. - * - * If the application provides its own implementation of - * vApplicationFPUSafeIRQHandler() then this implementation of - * vApplicationIRQHandler() will be called, save the FPU registers, and then - * call vApplicationFPUSafeIRQHandler(). - * - * Therefore, if the application writer wants FPU registers to be saved on - * interrupt entry their IRQ handler must be called - * vApplicationFPUSafeIRQHandler(), and if the application writer does not want - * FPU registers to be saved on interrupt entry their IRQ handler must be - * called vApplicationIRQHandler(). - *****************************************************************************/ - -.align 4 -.weak vApplicationIRQHandler -.type vApplicationIRQHandler, %function -vApplicationIRQHandler: - PUSH {LR} - FMRX R1, FPSCR - VPUSH {D0-D15} - VPUSH {D16-D31} - PUSH {R1} - - LDR r1, vApplicationFPUSafeIRQHandlerConst - BLX r1 - - POP {R0} - VPOP {D16-D31} - VPOP {D0-D15} - VMSR FPSCR, R0 - - POP {PC} - -/****************************************************************************** - * If the application provides an implementation of vApplicationIRQHandler(), - * then it will get called directly without saving the FPU registers on - * interrupt entry, and this weak implementation of - * vApplicationIRQHandler() will not get called. - * - * If the application provides its own implementation of - * vApplicationFPUSafeIRQHandler() then this implementation of - * vApplicationIRQHandler() will be called, save the FPU registers, and then - * call vApplicationFPUSafeIRQHandler(). - * - * Therefore, if the application writer wants FPU registers to be saved on - * interrupt entry their IRQ handler must be called - * vApplicationFPUSafeIRQHandler(), and if the application writer does not want - * FPU registers to be saved on interrupt entry their IRQ handler must be - * called vApplicationIRQHandler(). - *****************************************************************************/ - - -pxCurrentTCBConst: .word pxCurrentTCB -ulCriticalNestingConst: .word ulCriticalNesting -ulPortTaskHasFPUContextConst: .word ulPortTaskHasFPUContext -ulMaxAPIPriorityMaskConst: .word ulMaxAPIPriorityMask -vTaskSwitchContextConst: .word vTaskSwitchContext -vApplicationIRQHandlerConst: .word vApplicationIRQHandler -ulPortInterruptNestingConst: .word ulPortInterruptNesting -vApplicationFPUSafeIRQHandlerConst: .word vApplicationFPUSafeIRQHandler - -.end - - - - - diff --git a/third-party/freertos/portable/GCC/ft_platform_o/aarch32/portmacro.h b/third-party/freertos/portable/GCC/ft_platform_o/aarch32/portmacro.h deleted file mode 100644 index bbf98f73..00000000 --- a/third-party/freertos/portable/GCC/ft_platform_o/aarch32/portmacro.h +++ /dev/null @@ -1,201 +0,0 @@ -/* - * FreeRTOS Kernel V10.4.2 - * Copyright (C) 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * https://www.FreeRTOS.org - * https://github.com/FreeRTOS - * - * 1 tab == 4 spaces! - */ - -#ifndef PORTMACRO_H -#define PORTMACRO_H - -#ifdef __cplusplus -extern "C" -{ -#endif - -/*----------------------------------------------------------- - * Port specific definitions. - * - * The settings in this file configure FreeRTOS correctly for the given hardware - * and compiler. - * - * These settings should not be altered. - *----------------------------------------------------------- - */ - -/* Type definitions. */ -#define portCHAR char -#define portFLOAT float -#define portDOUBLE double -#define portLONG long -#define portSHORT short -#define portSTACK_TYPE uint32_t -#define portBASE_TYPE long - - typedef portSTACK_TYPE StackType_t; - typedef long BaseType_t; - typedef unsigned long UBaseType_t; - - typedef uint32_t TickType_t; -#define portMAX_DELAY (TickType_t)0xffffffffUL - -/* 32-bit tick type on a 32-bit architecture, so reads of the tick count do -not need to be guarded with a critical section. */ -#define portTICK_TYPE_IS_ATOMIC 1 - -/*-----------------------------------------------------------*/ - -/* Hardware specifics. */ -#define portSTACK_GROWTH (-1) -#define portTICK_PERIOD_MS ((TickType_t)1000 / configTICK_RATE_HZ) -#define portBYTE_ALIGNMENT 32 - -/*-----------------------------------------------------------*/ - -/* Task utilities. */ - -/* Called at the end of an ISR that can cause a context switch. */ -#define portEND_SWITCHING_ISR(xSwitchRequired) \ - { \ - extern uint32_t ulPortYieldRequired; \ - \ - if (xSwitchRequired != pdFALSE) \ - { \ - ulPortYieldRequired = pdTRUE; \ - } \ - } - -#define portYIELD_FROM_ISR(x) portEND_SWITCHING_ISR(x) -#define portYIELD() __asm volatile("SWI 0" :: \ - : "memory"); - - /*----------------------------------------------------------- - * Critical section control - *----------------------------------------------------------*/ - - extern void vPortEnterCritical(void); - extern void vPortExitCritical(void); - extern uint32_t ulPortSetInterruptMask(void); - extern void vPortClearInterruptMask(uint32_t ulNewMaskValue); - extern void vPortInstallFreeRTOSVectorTable(void); - -/* These macros do not globally disable/enable interrupts. They do mask off -interrupts that have a priority below configMAX_API_CALL_INTERRUPT_PRIORITY. */ -#define portENTER_CRITICAL() vPortEnterCritical(); -#define portEXIT_CRITICAL() vPortExitCritical(); -#define portDISABLE_INTERRUPTS() ulPortSetInterruptMask() -#define portENABLE_INTERRUPTS() vPortClearInterruptMask(0) -#define portSET_INTERRUPT_MASK_FROM_ISR() ulPortSetInterruptMask() -#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vPortClearInterruptMask(x) - -/*-----------------------------------------------------------*/ - -/* Task function macros as described on the FreeRTOS.org WEB site. These are -not required for this port but included in case common demo code that uses these -macros is used. */ -#define portTASK_FUNCTION_PROTO(vFunction, pvParameters) void vFunction(void *pvParameters) -#define portTASK_FUNCTION(vFunction, pvParameters) void vFunction(void *pvParameters) - - /* Prototype of the FreeRTOS tick handler. This must be installed as the -handler for whichever peripheral is used to generate the RTOS tick. */ - void FreeRTOS_Tick_Handler(void); - -/* If configUSE_TASK_FPU_SUPPORT is set to 1 (or left undefined) then tasks are -created without an FPU context and must call vPortTaskUsesFPU() to give -themselves an FPU context before using any FPU instructions. If -configUSE_TASK_FPU_SUPPORT is set to 2 then all tasks will have an FPU context -by default. */ -#if (configUSE_TASK_FPU_SUPPORT != 2) - void vPortTaskUsesFPU(void); -#else -/* Each task has an FPU context already, so define this function away to - nothing to prevent it being called accidentally. */ -#define vPortTaskUsesFPU() -#endif -#define portTASK_USES_FLOATING_POINT() vPortTaskUsesFPU() - -#define portLOWEST_INTERRUPT_PRIORITY (((uint32_t)configUNIQUE_INTERRUPT_PRIORITIES) - 1UL) -#define portLOWEST_USABLE_INTERRUPT_PRIORITY (portLOWEST_INTERRUPT_PRIORITY - 1UL) - -/* Architecture specific optimisations. */ -#ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION -#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 -#endif - -#if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1 - -/* Store/clear the ready priorities in a bit map. */ -#define portRECORD_READY_PRIORITY(uxPriority, uxReadyPriorities) (uxReadyPriorities) |= (1UL << (uxPriority)) -#define portRESET_READY_PRIORITY(uxPriority, uxReadyPriorities) (uxReadyPriorities) &= ~(1UL << (uxPriority)) - - /*-----------------------------------------------------------*/ - -#define portGET_HIGHEST_PRIORITY(uxTopPriority, uxReadyPriorities) uxTopPriority = (31UL - (uint32_t)__builtin_clz(uxReadyPriorities)) - -#endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */ - -#ifdef configASSERT - void vPortValidateInterruptPriority(void); -#define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() vPortValidateInterruptPriority() -#endif /* configASSERT */ - -#define portNOP() __asm volatile("NOP") -#define portINLINE __inline - -#ifdef __cplusplus -} /* extern C */ -#endif - -/* The number of bits to shift for an interrupt priority is dependent on the -number of bits implemented by the interrupt controller. */ -#if configUNIQUE_INTERRUPT_PRIORITIES == 16 -#define portPRIORITY_SHIFT 4 -#define portMAX_BINARY_POINT_VALUE 3 -#elif configUNIQUE_INTERRUPT_PRIORITIES == 32 -#define portPRIORITY_SHIFT 3 -#define portMAX_BINARY_POINT_VALUE 2 -#elif configUNIQUE_INTERRUPT_PRIORITIES == 64 -#define portPRIORITY_SHIFT 2 -#define portMAX_BINARY_POINT_VALUE 1 -#elif configUNIQUE_INTERRUPT_PRIORITIES == 128 -#define portPRIORITY_SHIFT 1 -#define portMAX_BINARY_POINT_VALUE 0 -#elif configUNIQUE_INTERRUPT_PRIORITIES == 256 -#define portPRIORITY_SHIFT 0 -#define portMAX_BINARY_POINT_VALUE 0 -#else -#error Invalid configUNIQUE_INTERRUPT_PRIORITIES setting. configUNIQUE_INTERRUPT_PRIORITIES must be set to the number of unique priorities implemented by the target hardware -#endif - -/* Interrupt controller access addresses. */ -#define portICCPMR_PRIORITY_MASK_OFFSET (0x04) -#define portICCIAR_INTERRUPT_ACKNOWLEDGE_OFFSET (0x0C) -#define portICCEOIR_END_OF_INTERRUPT_OFFSET (0x10) -#define portICCBPR_BINARY_POINT_OFFSET (0x08) -#define portICCRPR_RUNNING_PRIORITY_OFFSET (0x14) - - -#define portMEMORY_BARRIER() __asm volatile("" :: \ - : "memory") - -#endif /* PORTMACRO_H */ diff --git a/third-party/freertos/portable/GCC/ft_platform_o/aarch64/FreeRTOSConfig.h b/third-party/freertos/portable/GCC/ft_platform_o/aarch64/FreeRTOSConfig.h deleted file mode 100644 index 07566640..00000000 --- a/third-party/freertos/portable/GCC/ft_platform_o/aarch64/FreeRTOSConfig.h +++ /dev/null @@ -1,191 +0,0 @@ -/* - * FreeRTOS Kernel V10.0.1 - * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * http://www.FreeRTOS.org - * http://aws.amazon.com/freertos - * - * 1 tab == 4 spaces! - */ - -#ifndef FREERTOS_CONFIG_H -#define FREERTOS_CONFIG_H - -#include "parameters.h" - -/*----------------------------------------------------------- - * Application specific definitions. - * - * These definitions should be adjusted for your particular hardware and - * application requirements. - * - * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE - * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. - * - * See http://www.freertos.org/a00110.html. - *----------------------------------------------------------*/ - -/* - * The FreeRTOS Cortex-A port implements a full interrupt nesting model. - * - * Interrupts that are assigned a priority at or below - * configMAX_API_CALL_INTERRUPT_PRIORITY (which counter-intuitively in the ARM - * generic interrupt controller [GIC] means a priority that has a numerical - * value above configMAX_API_CALL_INTERRUPT_PRIORITY) can call FreeRTOS safe API - * functions and will nest. - * - * Interrupts that are assigned a priority above - * configMAX_API_CALL_INTERRUPT_PRIORITY (which in the GIC means a numerical - * value below configMAX_API_CALL_INTERRUPT_PRIORITY) cannot call any FreeRTOS - * API functions, will nest, and will not be masked by FreeRTOS critical - * sections (although it is necessary for interrupts to be globally disabled - * extremely briefly as the interrupt mask is updated in the GIC). - * - * FreeRTOS functions that can be called from an interrupt are those that end in - * "FromISR". FreeRTOS maintains a separate interrupt safe API to enable - * interrupt entry to be shorter, faster, simpler and smaller. - * - * For the purpose of setting configMAX_API_CALL_INTERRUPT_PRIORITY 255 - * represents the lowest priority. - */ -/* 在不安全group1 中 ,0x8 ~0xb 不可以使用安全api(优先级越低越高)*/ -#define configMAX_API_CALL_INTERRUPT_PRIORITY 0xb -/* 在不安全group1 中,16 is steps ,3 是其中等级*/ -#define configKERNEL_INTERRUPT_PRIORITY ((0x8 << 4) + 3 * 16) - -#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 -#define configUSE_TICKLESS_IDLE 0 -#define configTICK_RATE_HZ ((TickType_t)1000) -#define configPERIPHERAL_CLOCK_HZ (33333000UL) -#define configUSE_PREEMPTION 1 -#define configUSE_IDLE_HOOK 1 -#define configUSE_TICK_HOOK 1 -#define configMAX_PRIORITIES (8) -#define configMINIMAL_STACK_SIZE ((unsigned short)1024) -#define configTOTAL_HEAP_SIZE (1024 * 1024) -#define configMAX_TASK_NAME_LEN (10) -#define configUSE_16_BIT_TICKS 0 -#define configIDLE_SHOULD_YIELD 1 -#define configUSE_MUTEXES 1 -#define configQUEUE_REGISTRY_SIZE 8 -#define configUSE_RECURSIVE_MUTEXES 1 -#define configUSE_APPLICATION_TASK_TAG 0 -#define configUSE_COUNTING_SEMAPHORES 1 -#define configUSE_QUEUE_SETS 1 - -/* This demo creates RTOS objects using both static and dynamic allocation. */ -#define configSUPPORT_STATIC_ALLOCATION 1 -#define configSUPPORT_DYNAMIC_ALLOCATION 1 /* Defaults to 1 anyway. */ - -/* Co-routine definitions. */ -#define configUSE_CO_ROUTINES 0 -#define configMAX_CO_ROUTINE_PRIORITIES (2) - -/* Software timer definitions. */ -#define configUSE_TIMERS 1 -#define configTIMER_TASK_PRIORITY (configMAX_PRIORITIES - 1) -#define configTIMER_QUEUE_LENGTH 5 -#define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE * 2) - -/* Set the following definitions to 1 to include the API function, or zero -to exclude the API function. */ -#define INCLUDE_vTaskPrioritySet 1 -#define INCLUDE_uxTaskPriorityGet 1 -#define INCLUDE_vTaskDelete 1 -#define INCLUDE_vTaskCleanUpResources 1 -#define INCLUDE_vTaskSuspend 1 -#define INCLUDE_vTaskDelayUntil 1 -#define INCLUDE_vTaskDelay 1 -#define INCLUDE_xTimerPendFunctionCall 1 -#define INCLUDE_eTaskGetState 1 -#define INCLUDE_xTaskAbortDelay 1 -#define INCLUDE_xTaskGetHandle 1 - -#define INCLUDE_xSemaphoreGetMutexHolder 1 -#define configNUM_THREAD_LOCAL_STORAGE_POINTERS 5 -#define INCLUDE_xTaskGetIdleTaskHandle 1 - -/* This demo makes use of one or more example stats formatting functions. These -format the raw data provided by the uxTaskGetSystemState() function in to human -readable ASCII form. See the notes in the implementation of vTaskList() within -FreeRTOS/Source/tasks.c for limitations. */ -#define configUSE_STATS_FORMATTING_FUNCTIONS 1 - -/* Run time stats are not generated. portCONFIGURE_TIMER_FOR_RUN_TIME_STATS and -portGET_RUN_TIME_COUNTER_VALUE must be defined if configGENERATE_RUN_TIME_STATS -is set to 1. */ -#define configGENERATE_RUN_TIME_STATS 1 //启用运行时间统计功能 -extern volatile unsigned int gCpuRuntime; -#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() (gCpuRuntime = 0ul) -#define portGET_RUN_TIME_COUNTER_VALUE() gCpuRuntime - -/* The size of the global output buffer that is available for use when there -are multiple command interpreters running at once (for example, one on a UART -and one on TCP/IP). This is done to prevent an output buffer being defined by -each implementation - which would waste RAM. In this case, there is only one -command interpreter running. */ -#define configCOMMAND_INT_MAX_OUTPUT_SIZE 2096 - -/* Normal assert() semantics without relying on the provision of an assert.h -header file. */ -void vMainAssertCalled(const char *pcFileName, uint32_t ulLineNumber); -#define configASSERT(x) \ - if ((x) == 0) \ - { \ - vMainAssertCalled(__FILE__, __LINE__); \ - } - -/* If configTASK_RETURN_ADDRESS is not defined then a task that attempts to -return from its implementing function will end up in a "task exit error" -function - which contains a call to configASSERT(). However this can give GCC -some problems when it tries to unwind the stack, as the exit error function has -nothing to return to. To avoid this define configTASK_RETURN_ADDRESS to 0. */ -#define configTASK_RETURN_ADDRESS NULL - -/* Bump up the priority of recmuCONTROLLING_TASK_PRIORITY to prevent false -positive errors being reported considering the priority of other tasks in the -system. */ -#define recmuCONTROLLING_TASK_PRIORITY (configMAX_PRIORITIES - 2) - -/****** Hardware specific settings. *******************************************/ - -/* - * The application must provide a function that configures a peripheral to - * create the FreeRTOS tick interrupt, then define configSETUP_TICK_INTERRUPT() - * in FreeRTOSConfig.h to call the function. This file contains a function - * that is suitable for use on the Zynq MPU. FreeRTOS_Tick_Handler() must - * be installed as the peripheral's interrupt handler. - */ -void vConfigureTickInterrupt(void); -#define configSETUP_TICK_INTERRUPT() vConfigureTickInterrupt() - -void vClearTickInterrupt(void); -#define configCLEAR_TICK_INTERRUPT() vClearTickInterrupt() - -/* The following constant describe the hardware, and are correct for the -QEMU-Virt. */ -#define configINTERRUPT_CONTROLLER_BASE_ADDRESS (GICV3_DISTRIBUTOR_BASEADDRESS) -#define configUNIQUE_INTERRUPT_PRIORITIES 16 - -#define fabs(x) __builtin_fabs(x) - -#define configUSE_TRACE_FACILITY 1 - -#endif /* FREERTOS_CONFIG_H */ diff --git a/third-party/freertos/portable/GCC/ft_platform_o/aarch64/port.c b/third-party/freertos/portable/GCC/ft_platform_o/aarch64/port.c deleted file mode 100644 index 0798bcaf..00000000 --- a/third-party/freertos/portable/GCC/ft_platform_o/aarch64/port.c +++ /dev/null @@ -1,514 +0,0 @@ -/* - * FreeRTOS Kernel V10.0.1 - * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * http://www.FreeRTOS.org - * http://aws.amazon.com/freertos - * - * 1 tab == 4 spaces! - */ - -/* Standard includes. */ -#include -#include -/* Scheduler includes. */ -#include "FreeRTOS.h" -#include "task.h" -#include "ft_types.h" -#include "gicv3_cpuif.h" - -#ifndef configUNIQUE_INTERRUPT_PRIORITIES -#error configUNIQUE_INTERRUPT_PRIORITIES must be defined. See http://www.freertos.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html -#endif - -#ifndef configSETUP_TICK_INTERRUPT -#error configSETUP_TICK_INTERRUPT() must be defined. See http://www.freertos.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html -#endif /* configSETUP_TICK_INTERRUPT */ - -#ifndef configMAX_API_CALL_INTERRUPT_PRIORITY -#error configMAX_API_CALL_INTERRUPT_PRIORITY must be defined. See http://www.freertos.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors.html -#endif - -#if configMAX_API_CALL_INTERRUPT_PRIORITY == 0 -#error configMAX_API_CALL_INTERRUPT_PRIORITY must not be set to 0 -#endif - -#if configMAX_API_CALL_INTERRUPT_PRIORITY > configUNIQUE_INTERRUPT_PRIORITIES -#error configMAX_API_CALL_INTERRUPT_PRIORITY must be less than or equal to configUNIQUE_INTERRUPT_PRIORITIES as the lower the numeric priority value the higher the logical interrupt priority -#endif - -#if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1 -/* Check the configuration. */ -#if (configMAX_PRIORITIES > 32) -#error configUSE_PORT_OPTIMISED_TASK_SELECTION can only be set to 1 when configMAX_PRIORITIES is less than or equal to 32. It is very rare that a system requires more than 10 to 15 difference priorities as tasks that share a priority will time slice. -#endif -#endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */ - -/* In case security extensions are implemented. */ -#if configMAX_API_CALL_INTERRUPT_PRIORITY <= (configUNIQUE_INTERRUPT_PRIORITIES / 2) -#error configMAX_API_CALL_INTERRUPT_PRIORITY must be greater than ( configUNIQUE_INTERRUPT_PRIORITIES / 2 ) -#endif - -/* Some vendor specific files default configCLEAR_TICK_INTERRUPT() in -portmacro.h. */ -#ifndef configCLEAR_TICK_INTERRUPT -#define configCLEAR_TICK_INTERRUPT() -#endif - -/* A critical section is exited when the critical section nesting count reaches -this value. */ -#define portNO_CRITICAL_NESTING ((size_t)0) - -/* In all GICs 255 can be written to the priority mask register to unmask all -(but the lowest) interrupt priority. */ -#define portUNMASK_VALUE (0xF0UL) - -/* Tasks are not created with a floating point context, but can be given a -floating point context after they have been created. A variable is stored as -part of the tasks context that holds portNO_FLOATING_POINT_CONTEXT if the task -does not have an FPU context, or any other value if the task does have an FPU -context. */ -#define portNO_FLOATING_POINT_CONTEXT ((StackType_t)0) - -/* Constants required to setup the initial task context. */ -#define portSP_ELx ((StackType_t)0x01) -#define portSP_EL0 ((StackType_t)0x00) - -#if defined(GUEST) -#define portEL1 ((StackType_t)0x04) -#define portINITIAL_PSTATE (portEL1 | portSP_EL0) -#else -#define portEL3 ((StackType_t)0x0c) -/* At the time of writing, the BSP only supports EL3. */ -#define portINITIAL_PSTATE (portEL3 | portSP_EL0) -#endif - -/* Used by portASSERT_IF_INTERRUPT_PRIORITY_INVALID() when ensuring the binary -point is zero. */ -#define portBINARY_POINT_BITS ((uint8_t)0x03) - -/* Masks all bits in the APSR other than the mode bits. */ -#define portAPSR_MODE_BITS_MASK (0x0C) - -/* The I bit in the DAIF bits. */ -#define portDAIF_I (0x80) - -/* Macro to unmask all interrupt priorities. */ -#define portCLEAR_INTERRUPT_MASK() \ - { \ - portDISABLE_INTERRUPTS(); \ - setPriorityMask(portUNMASK_VALUE); \ - __asm volatile("DSB SY \n" \ - "ISB SY \n"); \ - portENABLE_INTERRUPTS(); \ - } - -/* Hardware specifics used when sanity checking the configuration. */ -#define portINTERRUPT_PRIORITY_REGISTER_OFFSET (0x400UL + 32UL) // -#define portMAX_8_BIT_VALUE ((uint8_t)0xff) -#define portBIT_0_SET ((uint8_t)0x01) - -/*-----------------------------------------------------------*/ - -/* - * Starts the first task executing. This function is necessarily written in - * assembly code so is implemented in portASM.s. - */ -extern void vPortRestoreTaskContext(void); - -/*-----------------------------------------------------------*/ - -/* A variable is used to keep track of the critical section nesting. This -variable has to be stored as part of the task context and must be initialised to -a non zero value to ensure interrupts don't inadvertently become unmasked before -the scheduler starts. As it is stored as part of the task context it will -automatically be set to 0 when the first task is started. */ -volatile uint64_t ullCriticalNesting = 9999ULL; - -/* Saved as part of the task context. If ullPortTaskHasFPUContext is non-zero -then floating point context must be saved and restored for the task. */ -uint64_t ullPortTaskHasFPUContext = pdFALSE; - -/* Set to 1 to pend a context switch from an ISR. */ -uint64_t ullPortYieldRequired = pdFALSE; - -/* Counts the interrupt nesting depth. A context switch is only performed if -if the nesting depth is 0. */ -uint64_t ullPortInterruptNesting = pdFALSE; - -/* Used in the ASM code. */ -__attribute__((used)) const uint64_t ullMaxAPIPriorityMask = (configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT); - -/*-----------------------------------------------------------*/ - -/* - * See header file for description. - */ -StackType_t *pxPortInitialiseStack(StackType_t *pxTopOfStack, TaskFunction_t pxCode, void *pvParameters) -{ - /* Setup the initial stack of the task. The stack is set exactly as - expected by the portRESTORE_CONTEXT() macro. */ - - /* First all the general purpose registers. */ - pxTopOfStack--; - *pxTopOfStack = 0x0101010101010101ULL; /* R1 */ - pxTopOfStack--; - *pxTopOfStack = (StackType_t)pvParameters; /* R0 */ - pxTopOfStack--; - *pxTopOfStack = 0x0303030303030303ULL; /* R3 */ - pxTopOfStack--; - *pxTopOfStack = 0x0202020202020202ULL; /* R2 */ - pxTopOfStack--; - *pxTopOfStack = 0x0505050505050505ULL; /* R5 */ - pxTopOfStack--; - *pxTopOfStack = 0x0404040404040404ULL; /* R4 */ - pxTopOfStack--; - *pxTopOfStack = 0x0707070707070707ULL; /* R7 */ - pxTopOfStack--; - *pxTopOfStack = 0x0606060606060606ULL; /* R6 */ - pxTopOfStack--; - *pxTopOfStack = 0x0909090909090909ULL; /* R9 */ - pxTopOfStack--; - *pxTopOfStack = 0x0808080808080808ULL; /* R8 */ - pxTopOfStack--; - *pxTopOfStack = 0x1111111111111111ULL; /* R11 */ - pxTopOfStack--; - *pxTopOfStack = 0x1010101010101010ULL; /* R10 */ - pxTopOfStack--; - *pxTopOfStack = 0x1313131313131313ULL; /* R13 */ - pxTopOfStack--; - *pxTopOfStack = 0x1212121212121212ULL; /* R12 */ - pxTopOfStack--; - *pxTopOfStack = 0x1515151515151515ULL; /* R15 */ - pxTopOfStack--; - *pxTopOfStack = 0x1414141414141414ULL; /* R14 */ - pxTopOfStack--; - *pxTopOfStack = 0x1717171717171717ULL; /* R17 */ - pxTopOfStack--; - *pxTopOfStack = 0x1616161616161616ULL; /* R16 */ - pxTopOfStack--; - *pxTopOfStack = 0x1919191919191919ULL; /* R19 */ - pxTopOfStack--; - *pxTopOfStack = 0x1818181818181818ULL; /* R18 */ - pxTopOfStack--; - *pxTopOfStack = 0x2121212121212121ULL; /* R21 */ - pxTopOfStack--; - *pxTopOfStack = 0x2020202020202020ULL; /* R20 */ - pxTopOfStack--; - *pxTopOfStack = 0x2323232323232323ULL; /* R23 */ - pxTopOfStack--; - *pxTopOfStack = 0x2222222222222222ULL; /* R22 */ - pxTopOfStack--; - *pxTopOfStack = 0x2525252525252525ULL; /* R25 */ - pxTopOfStack--; - *pxTopOfStack = 0x2424242424242424ULL; /* R24 */ - pxTopOfStack--; - *pxTopOfStack = 0x2727272727272727ULL; /* R27 */ - pxTopOfStack--; - *pxTopOfStack = 0x2626262626262626ULL; /* R26 */ - pxTopOfStack--; - *pxTopOfStack = 0x2929292929292929ULL; /* R29 */ - pxTopOfStack--; - *pxTopOfStack = 0x2828282828282828ULL; /* R28 */ - pxTopOfStack--; - *pxTopOfStack = (StackType_t)0x00; /* XZR - has no effect, used so there are an even number of registers. */ - pxTopOfStack--; - *pxTopOfStack = (StackType_t)0x00; /* R30 - procedure call link register. */ - pxTopOfStack--; - - *pxTopOfStack = portINITIAL_PSTATE; - pxTopOfStack--; - - *pxTopOfStack = (StackType_t)pxCode; /* Exception return address. */ - pxTopOfStack--; - - /* The task will start with a critical nesting count of 0 as interrupts are - enabled. */ - *pxTopOfStack = portNO_CRITICAL_NESTING; - pxTopOfStack--; - - /* The task will start without a floating point context. A task that uses - the floating point hardware must call vPortTaskUsesFPU() before executing - any floating point instructions. */ - *pxTopOfStack = portNO_FLOATING_POINT_CONTEXT; - - return pxTopOfStack; -} -/*-----------------------------------------------------------*/ - -BaseType_t xPortStartScheduler(void) -{ - uint32_t ulAPSR; - -#if (configASSERT_DEFINED == 1) - { - volatile uint32_t ulOriginalPriority; - volatile uint8_t *const pucFirstUserPriorityRegister = (volatile uint8_t *const)(configINTERRUPT_CONTROLLER_BASE_ADDRESS + portINTERRUPT_PRIORITY_REGISTER_OFFSET); - volatile uint8_t ucMaxPriorityValue; - if(pucFirstUserPriorityRegister != 0) - { - /* Determine how many priority bits are implemented in the GIC. - Save the interrupt priority value that is about to be clobbered. */ - ulOriginalPriority = *pucFirstUserPriorityRegister; - /* Determine the number of priority bits available. First write to - all possible bits. */ - *pucFirstUserPriorityRegister = portMAX_8_BIT_VALUE; - - /* Read the value back to see how many bits stuck. */ - ucMaxPriorityValue = *pucFirstUserPriorityRegister; - - if(ucMaxPriorityValue != 0) - { - /* Shift to the least significant bits. */ - while ((ucMaxPriorityValue & portBIT_0_SET) != portBIT_0_SET) - { - ucMaxPriorityValue >>= (uint8_t)0x01; - } - /* Sanity check configUNIQUE_INTERRUPT_PRIORITIES matches the read - value. */ - configASSERT(ucMaxPriorityValue >= portLOWEST_INTERRUPT_PRIORITY); - } - - /* Restore the clobbered interrupt priority register to its original - value. */ - *pucFirstUserPriorityRegister = ulOriginalPriority; - } - - } -#endif /* conifgASSERT_DEFINED */ - - /* At the time of writing, the BSP only supports EL1. */ - __asm volatile("MRS %0, CurrentEL" - : "=r"(ulAPSR)); - ulAPSR &= portAPSR_MODE_BITS_MASK; -#if defined(GUEST) - configASSERT(ulAPSR == portEL1); - if (ulAPSR == portEL1) -#else - configASSERT(ulAPSR == portEL3); - if (ulAPSR == portEL3) -#endif - { - /* Only continue if the binary point value is set to its lowest possible - setting. See the comments in vPortValidateInterruptPriority() below for - more information. */ - // configASSERT((portICCBPR_BINARY_POINT_REGISTER & portBINARY_POINT_BITS) <= portMAX_BINARY_POINT_VALUE); - configASSERT((getBPR1() & portBINARY_POINT_BITS) <= portMAX_BINARY_POINT_VALUE); - - // if ((portICCBPR_BINARY_POINT_REGISTER & portBINARY_POINT_BITS) <= portMAX_BINARY_POINT_VALUE) - if ((getBPR1() & portBINARY_POINT_BITS) <= portMAX_BINARY_POINT_VALUE) - { - /* Interrupts are turned off in the CPU itself to ensure a tick does - not execute while the scheduler is being started. Interrupts are - automatically turned back on in the CPU when the first task starts - executing. */ - portDISABLE_INTERRUPTS(); - - /* Start the timer that generates the tick ISR. */ - configSETUP_TICK_INTERRUPT(); - - /* Start the first task executing. */ - vPortRestoreTaskContext(); - } - } - - return 0; -} -/*-----------------------------------------------------------*/ - -void vPortEndScheduler(void) -{ - /* Not implemented in ports where there is nothing to return to. - Artificially force an assert. */ - configASSERT(ullCriticalNesting == 1000ULL); -} -/*-----------------------------------------------------------*/ - -void vPortEnterCritical(void) -{ - /* Mask interrupts up to the max syscall interrupt priority. */ - uxPortSetInterruptMask(); - - /* Now interrupts are disabled ullCriticalNesting can be accessed - directly. Increment ullCriticalNesting to keep a count of how many times - portENTER_CRITICAL() has been called. */ - ullCriticalNesting++; - - /* This is not the interrupt safe version of the enter critical function so - assert() if it is being called from an interrupt context. Only API - functions that end in "FromISR" can be used in an interrupt. Only assert if - the critical nesting count is 1 to protect against recursive calls if the - assert function also uses a critical section. */ - if (ullCriticalNesting == 1ULL) - { - configASSERT(ullPortInterruptNesting == 0); - } -} -/*-----------------------------------------------------------*/ - -void vPortExitCritical(void) -{ - if (ullCriticalNesting > portNO_CRITICAL_NESTING) - { - /* Decrement the nesting count as the critical section is being - exited. */ - ullCriticalNesting--; - - /* If the nesting level has reached zero then all interrupt - priorities must be re-enabled. */ - if (ullCriticalNesting == portNO_CRITICAL_NESTING) - { - /* Critical nesting has reached zero so all interrupt priorities - should be unmasked. */ - portCLEAR_INTERRUPT_MASK(); - } - } -} -/*-----------------------------------------------------------*/ - -void FreeRTOS_Tick_Handler(void) -{ -/* Interrupts should not be enabled before this point. */ -#if (configASSERT_DEFINED == 1) - { - uint32_t ulMaskBits; - - __asm volatile("mrs %0, daif" - : "=r"(ulMaskBits)::"memory"); - configASSERT((ulMaskBits & portDAIF_I) != 0); - } -#endif /* configASSERT_DEFINED */ - - /* Set interrupt mask before altering scheduler structures. The tick - handler runs at the lowest priority, so interrupts cannot already be masked, - so there is no need to save and restore the current mask value. It is - necessary to turn off interrupts in the CPU itself while the ICCPMR is being - updated. */ - - setPriorityMask(configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT); - __asm volatile("dsb sy \n" - "isb sy \n" :: - : "memory"); - - /* Ok to enable interrupts after the interrupt source has been cleared. */ - configCLEAR_TICK_INTERRUPT(); - portENABLE_INTERRUPTS(); - - /* Increment the RTOS tick. */ - if (xTaskIncrementTick() != pdFALSE) - { - ullPortYieldRequired = pdTRUE; - } - - /* Ensure all interrupt priorities are active again. */ - portCLEAR_INTERRUPT_MASK(); -} -/*-----------------------------------------------------------*/ - -void vPortTaskUsesFPU(void) -{ - /* A task is registering the fact that it needs an FPU context. Set the - FPU flag (which is saved as part of the task context). */ - ullPortTaskHasFPUContext = pdTRUE; - printf("ullPortTaskHasFPUContext %x \r\n", ullPortTaskHasFPUContext); - /* Consider initialising the FPSR here - but probably not necessary in - AArch64. */ -} -/*-----------------------------------------------------------*/ - -void vPortClearInterruptMask(UBaseType_t uxNewMaskValue) -{ - if (uxNewMaskValue == pdFALSE) - { - portCLEAR_INTERRUPT_MASK(); - } -} -/*-----------------------------------------------------------*/ - -UBaseType_t uxPortSetInterruptMask(void) -{ - uint32_t ulReturn; - - /* Interrupt in the CPU must be turned off while the ICCPMR is being - updated. */ - portDISABLE_INTERRUPTS(); - if (getPriorityMask() == (uint32_t)(configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT)) - { - /* Interrupts were already masked. */ - ulReturn = pdTRUE; - } - else - { - ulReturn = pdFALSE; - setPriorityMask(configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT); - // portICCPMR_PRIORITY_MASK_REGISTER = (uint32_t)(configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT); - __asm volatile("dsb sy \n" - "isb sy \n" :: - : "memory"); - } - portENABLE_INTERRUPTS(); - - return ulReturn; -} -/*-----------------------------------------------------------*/ - -#if (configASSERT_DEFINED == 1) - -void vPortValidateInterruptPriority(void) -{ - /* The following assertion will fail if a service routine (ISR) for - an interrupt that has been assigned a priority above - configMAX_SYSCALL_INTERRUPT_PRIORITY calls an ISR safe FreeRTOS API - function. ISR safe FreeRTOS API functions must *only* be called - from interrupts that have been assigned a priority at or below - configMAX_SYSCALL_INTERRUPT_PRIORITY. - - Numerically low interrupt priority numbers represent logically high - interrupt priorities, therefore the priority of the interrupt must - be set to a value equal to or numerically *higher* than - configMAX_SYSCALL_INTERRUPT_PRIORITY. - - FreeRTOS maintains separate thread and ISR API functions to ensure - interrupt entry is as fast and simple as possible. */ - configASSERT(getRunningPriority() >= (uint32_t)(configMAX_API_CALL_INTERRUPT_PRIORITY << portPRIORITY_SHIFT)); - - /* Priority grouping: The interrupt controller (GIC) allows the bits - that define each interrupt's priority to be split between bits that - define the interrupt's pre-emption priority bits and bits that define - the interrupt's sub-priority. For simplicity all bits must be defined - to be pre-emption priority bits. The following assertion will fail if - this is not the case (if some bits represent a sub-priority). - - The priority grouping is configured by the GIC's binary point register - (ICCBPR). Writting 0 to ICCBPR will ensure it is set to its lowest - possible value (which may be above 0). */ - configASSERT((getBPR1() & portBINARY_POINT_BITS) <= portMAX_BINARY_POINT_VALUE); -} - -#endif /* configASSERT_DEFINED */ -/*-----------------------------------------------------------*/ - -_WEAK void vApplicationTickHook(void) -{ -} - -_WEAK void vApplicationIdleHook(void) -{ -} diff --git a/third-party/freertos/portable/GCC/ft_platform_o/aarch64/portASM.S b/third-party/freertos/portable/GCC/ft_platform_o/aarch64/portASM.S deleted file mode 100644 index 5530452f..00000000 --- a/third-party/freertos/portable/GCC/ft_platform_o/aarch64/portASM.S +++ /dev/null @@ -1,433 +0,0 @@ -/* - * FreeRTOS Kernel V10.0.1 - * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * http://www.FreeRTOS.org - * http://aws.amazon.com/freertos - * - * 1 tab == 4 spaces! - */ -#include "gicv3_aliases.h" - - .text - - /* Variables and functions. */ - .extern ullMaxAPIPriorityMask - .extern pxCurrentTCB - .extern vTaskSwitchContext - .extern vApplicationIRQHandler - .extern ullPortInterruptNesting - .extern ullPortTaskHasFPUContext - .extern ullCriticalNesting - .extern ullPortYieldRequired - .extern ullICCEOIR - .extern ullICCIAR - .extern _freertos_vector_table - - .global FreeRTOS_IRQ_Handler - .global FreeRTOS_SWI_Handler - .global vPortRestoreTaskContext - - - - -.macro portSAVE_CONTEXT - /* Switch to use the EL0 stack pointer. */ - MSR SPSEL, #0 - - /* Save the entire context. */ - STP X0, X1, [SP, #-0x10]! - STP X2, X3, [SP, #-0x10]! - STP X4, X5, [SP, #-0x10]! - STP X6, X7, [SP, #-0x10]! - STP X8, X9, [SP, #-0x10]! - STP X10, X11, [SP, #-0x10]! - STP X12, X13, [SP, #-0x10]! - STP X14, X15, [SP, #-0x10]! - STP X16, X17, [SP, #-0x10]! - STP X18, X19, [SP, #-0x10]! - STP X20, X21, [SP, #-0x10]! - STP X22, X23, [SP, #-0x10]! - STP X24, X25, [SP, #-0x10]! - STP X26, X27, [SP, #-0x10]! - STP X28, X29, [SP, #-0x10]! - STP X30, XZR, [SP, #-0x10]! - - /* Save the SPSR. */ -#if defined( GUEST ) - MRS X3, SPSR_EL1 - MRS X2, ELR_EL1 -#else - MRS X3, SPSR_EL3 - /* Save the ELR. */ - MRS X2, ELR_EL3 -#endif - - STP X2, X3, [SP, #-0x10]! - - /* Save the critical section nesting depth. */ - LDR X0, ullCriticalNestingConst - LDR X3, [X0] - - /* Save the FPU context indicator. */ - LDR X0, ullPortTaskHasFPUContextConst - LDR X2, [X0] - - /* Save the FPU context, if any (32 128-bit registers). */ - CMP X2, #0 - B.EQ 1f - STP Q0, Q1, [SP,#-0x20]! - STP Q2, Q3, [SP,#-0x20]! - STP Q4, Q5, [SP,#-0x20]! - STP Q6, Q7, [SP,#-0x20]! - STP Q8, Q9, [SP,#-0x20]! - STP Q10, Q11, [SP,#-0x20]! - STP Q12, Q13, [SP,#-0x20]! - STP Q14, Q15, [SP,#-0x20]! - STP Q16, Q17, [SP,#-0x20]! - STP Q18, Q19, [SP,#-0x20]! - STP Q20, Q21, [SP,#-0x20]! - STP Q22, Q23, [SP,#-0x20]! - STP Q24, Q25, [SP,#-0x20]! - STP Q26, Q27, [SP,#-0x20]! - STP Q28, Q29, [SP,#-0x20]! - STP Q30, Q31, [SP,#-0x20]! - -1: - /* Store the critical nesting count and FPU context indicator. */ - STP X2, X3, [SP, #-0x10]! - - LDR X0, pxCurrentTCBConst - LDR X1, [X0] - MOV X0, SP /* Move SP into X0 for saving. */ - STR X0, [X1] - - /* Switch to use the ELx stack pointer. */ - MSR SPSEL, #1 - - .endm - -; /**********************************************************************/ - - - - -.macro portRESTORE_CONTEXT - - /* Switch to use the EL0 stack pointer. */ - MSR SPSEL, #0 - - /* Set the SP to point to the stack of the task being restored. */ - LDR X0, pxCurrentTCBConst - LDR X1, [X0] - LDR X0, [X1] - MOV SP, X0 - - LDP X2, X3, [SP], #0x10 /* Critical nesting and FPU context. */ - - /* Set the PMR register to be correct for the current critical nesting - depth. */ - LDR X0, ullCriticalNestingConst /* X0 holds the address of ullCriticalNesting. */ - MOV X1, #255 /* X1 holds the unmask value. */ - CMP X3, #0 - B.EQ 1f - LDR X6, ullMaxAPIPriorityMaskConst - LDR X1, [X6] /* X1 holds the mask value. */ -1: - //STR W1, [X5] /* Write the mask value to ICCPMR. */ - MSR S3_0_C4_C6_0, X1 - DSB SY /* _RB_Barriers probably not required here. */ - ISB SY - STR X3, [X0] /* Restore the task's critical nesting count. */ - - /* Restore the FPU context indicator. */ - LDR X0, ullPortTaskHasFPUContextConst - STR X2, [X0] - - /* Restore the FPU context, if any. */ - CMP X2, #0 - B.EQ 1f - - LDP Q30, Q31, [SP], #0x20 - LDP Q28, Q29, [SP], #0x20 - LDP Q26, Q27, [SP], #0x20 - LDP Q24, Q25, [SP], #0x20 - LDP Q22, Q23, [SP], #0x20 - LDP Q20, Q21, [SP], #0x20 - LDP Q18, Q19, [SP], #0x20 - LDP Q16, Q17, [SP], #0x20 - LDP Q14, Q15, [SP], #0x20 - LDP Q12, Q13, [SP], #0x20 - LDP Q10, Q11, [SP], #0x20 - LDP Q8, Q9, [SP], #0x20 - LDP Q6, Q7, [SP], #0x20 - LDP Q4, Q5, [SP], #0x20 - LDP Q2, Q3, [SP], #0x20 - LDP Q0, Q1, [SP], #0x20 -1: - LDP X2, X3, [SP], #0x10 /* SPSR and ELR. */ - -#if defined( GUEST ) - /* Restore the SPSR. */ - MSR SPSR_EL1, X3 - /* Restore the ELR. */ - MSR ELR_EL1, X2 -#else - /* Restore the SPSR. */ - MSR SPSR_EL3, X3 /*_RB_ Assumes started in EL3. */ - /* Restore the ELR. */ - MSR ELR_EL3, X2 -#endif - - LDP X30, XZR, [SP], #0x10 - LDP X28, X29, [SP], #0x10 - LDP X26, X27, [SP], #0x10 - LDP X24, X25, [SP], #0x10 - LDP X22, X23, [SP], #0x10 - LDP X20, X21, [SP], #0x10 - LDP X18, X19, [SP], #0x10 - LDP X16, X17, [SP], #0x10 - LDP X14, X15, [SP], #0x10 - LDP X12, X13, [SP], #0x10 - LDP X10, X11, [SP], #0x10 - LDP X8, X9, [SP], #0x10 - LDP X6, X7, [SP], #0x10 - LDP X4, X5, [SP], #0x10 - LDP X2, X3, [SP], #0x10 - LDP X0, X1, [SP], #0x10 - - /* Switch to use the ELx stack pointer. _RB_ Might not be required. */ - MSR SPSEL, #1 - - ERET - - .endm - - -/****************************************************************************** - * FreeRTOS_SWI_Handler handler is used to perform a context switch. - *****************************************************************************/ -.align 8 -.type FreeRTOS_SWI_Handler, %function -FreeRTOS_SWI_Handler: - /* Save the context of the current task and select a new task to run. */ - portSAVE_CONTEXT -#if defined( GUEST ) - MRS X0, ESR_EL1 -#else - MRS X0, ESR_EL3 -#endif - - LSR X1, X0, #26 - -#if defined( GUEST ) - CMP X1, #0x15 /* 0x15 = SVC instruction. */ -#else - CMP X1, #0x17 /* 0x17 = SMC instruction. */ -#endif - B.NE FreeRTOS_Abort - BL vTaskSwitchContext - - portRESTORE_CONTEXT - -FreeRTOS_Abort: - /* Full ESR is in X0, exception class code is in X1. */ - B . - -/****************************************************************************** - * vPortRestoreTaskContext is used to start the scheduler. - *****************************************************************************/ -.align 8 -.type vPortRestoreTaskContext, %function -vPortRestoreTaskContext: -.set freertos_vector_base, _freertos_vector_table - - /* Install the FreeRTOS interrupt handlers. */ - LDR X1, =freertos_vector_base -#if defined( GUEST ) - MSR VBAR_EL1, X1 -#else - MSR VBAR_EL3, X1 -#endif - DSB SY - ISB SY - - /* Start the first task. */ - portRESTORE_CONTEXT - - -/****************************************************************************** - * FreeRTOS_IRQ_Handler handles IRQ entry and exit. - *****************************************************************************/ -.align 8 -.type FreeRTOS_IRQ_Handler, %function -FreeRTOS_IRQ_Handler: - /* Save volatile registers. */ - STP X0, X1, [SP, #-0x10]! - STP X2, X3, [SP, #-0x10]! - STP X4, X5, [SP, #-0x10]! - STP X6, X7, [SP, #-0x10]! - STP X8, X9, [SP, #-0x10]! - STP X10, X11, [SP, #-0x10]! - STP X12, X13, [SP, #-0x10]! - STP X14, X15, [SP, #-0x10]! - STP X16, X17, [SP, #-0x10]! - STP X18, X19, [SP, #-0x10]! - STP X29, X30, [SP, #-0x10]! - - /* Save the SPSR and ELR. */ -#if defined( GUEST ) - MRS X3, SPSR_EL1 - MRS X2, ELR_EL1 -#else - MRS X3, SPSR_EL3 - MRS X2, ELR_EL3 -#endif - STP X2, X3, [SP, #-0x10]! - - /* Increment the interrupt nesting counter. */ - LDR X5, ullPortInterruptNestingConst - LDR X1, [X5] /* Old nesting count in X1. */ - ADD X6, X1, #1 - STR X6, [X5] /* Address of nesting count variable in X5. */ - - /* Maintain the interrupt nesting information across the function call. */ - STP X1, X5, [SP, #-0x10]! - - - /* Read value from the interrupt acknowledge register, which is stored in W0 - for future parameter and interrupt clearing use. */ - - MRS X0, ICC_IAR1_EL1 /* ICCIAR in x0 as parameter. */ - - /* Maintain the ICCIAR value across the function call. */ - STP X0, X1, [SP, #-0x10]! - - /* Call the C handler. */ - BL vApplicationIRQHandler - - /* Disable interrupts. */ - MSR DAIFSET, #2 - DSB SY - ISB SY - - /* Restore the ICCIAR value. */ - LDP X0, X1, [SP], #0x10 - - /* End IRQ processing by writing ICCIAR to the EOI register. */ - - MSR ICC_EOIR1_EL1, x0 - - - /* Restore the critical nesting count. */ - LDP X1, X5, [SP], #0x10 - STR X1, [X5] - - /* Has interrupt nesting unwound? */ - CMP X1, #0 - B.NE Exit_IRQ_No_Context_Switch - - /* Is a context switch required? */ - LDR X0, ullPortYieldRequiredConst - LDR X1, [X0] - CMP X1, #0 - B.EQ Exit_IRQ_No_Context_Switch - - /* Reset ullPortYieldRequired to 0. */ - MOV X2, #0 - STR X2, [X0] - - /* Restore volatile registers. */ - LDP X4, X5, [SP], #0x10 /* SPSR and ELR. */ -#if defined( GUEST ) - MSR SPSR_EL1, X5 - MSR ELR_EL1, X4 -#else - MSR SPSR_EL3, X5 /*_RB_ Assumes started in EL3. */ - MSR ELR_EL3, X4 -#endif - DSB SY - ISB SY - - LDP X29, X30, [SP], #0x10 - LDP X18, X19, [SP], #0x10 - LDP X16, X17, [SP], #0x10 - LDP X14, X15, [SP], #0x10 - LDP X12, X13, [SP], #0x10 - LDP X10, X11, [SP], #0x10 - LDP X8, X9, [SP], #0x10 - LDP X6, X7, [SP], #0x10 - LDP X4, X5, [SP], #0x10 - LDP X2, X3, [SP], #0x10 - LDP X0, X1, [SP], #0x10 - - /* Save the context of the current task and select a new task to run. */ - portSAVE_CONTEXT - BL vTaskSwitchContext - portRESTORE_CONTEXT - -Exit_IRQ_No_Context_Switch: - /* Restore volatile registers. */ - LDP X4, X5, [SP], #0x10 /* SPSR and ELR. */ -#if defined( GUEST ) - MSR SPSR_EL1, X5 - MSR ELR_EL1, X4 -#else - MSR SPSR_EL3, X5 /*_RB_ Assumes started in EL3. */ - MSR ELR_EL3, X4 -#endif - DSB SY - ISB SY - - LDP X29, X30, [SP], #0x10 - LDP X18, X19, [SP], #0x10 - LDP X16, X17, [SP], #0x10 - LDP X14, X15, [SP], #0x10 - LDP X12, X13, [SP], #0x10 - LDP X10, X11, [SP], #0x10 - LDP X8, X9, [SP], #0x10 - LDP X6, X7, [SP], #0x10 - LDP X4, X5, [SP], #0x10 - LDP X2, X3, [SP], #0x10 - LDP X0, X1, [SP], #0x10 - - ERET - - - - -.align 8 -pxCurrentTCBConst: .dword pxCurrentTCB -ullCriticalNestingConst: .dword ullCriticalNesting -ullPortTaskHasFPUContextConst: .dword ullPortTaskHasFPUContext -ullMaxAPIPriorityMaskConst: .dword ullMaxAPIPriorityMask -vApplicationIRQHandlerConst: .dword vApplicationIRQHandler -ullPortInterruptNestingConst: .dword ullPortInterruptNesting -ullPortYieldRequiredConst: .dword ullPortYieldRequired - - - - -.end - - - - - diff --git a/third-party/freertos/portable/GCC/ft_platform_o/aarch64/portmacro.h b/third-party/freertos/portable/GCC/ft_platform_o/aarch64/portmacro.h deleted file mode 100644 index ad1b1364..00000000 --- a/third-party/freertos/portable/GCC/ft_platform_o/aarch64/portmacro.h +++ /dev/null @@ -1,211 +0,0 @@ -/* - * FreeRTOS Kernel V10.0.1 - * Copyright (C) 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * http://www.FreeRTOS.org - * http://aws.amazon.com/freertos - * - * 1 tab == 4 spaces! - */ - -#ifndef PORTMACRO_H -#define PORTMACRO_H - -#ifdef __cplusplus -extern "C" -{ -#endif -#include "ft_types.h" -/*----------------------------------------------------------- - * Port specific definitions. - * - * The settings in this file configure FreeRTOS correctly for the given hardware - * and compiler. - * - * These settings should not be altered. - *----------------------------------------------------------- - */ - -/* Type definitions. */ -#define portCHAR char -#define portFLOAT float -#define portDOUBLE double -#define portLONG long -#define portSHORT short -#define portSTACK_TYPE size_t -#define portBASE_TYPE long - - typedef portSTACK_TYPE StackType_t; - typedef portBASE_TYPE BaseType_t; - typedef uint64_t UBaseType_t; - - typedef uint64_t TickType_t; -#define portMAX_DELAY ((TickType_t)0xffffffffffffffff) - -/* 32-bit tick type on a 32-bit architecture, so reads of the tick count do -not need to be guarded with a critical section. */ -#define portTICK_TYPE_IS_ATOMIC 1 - -/*-----------------------------------------------------------*/ - -/* Hardware specifics. */ -#define portSTACK_GROWTH (-1) -#define portTICK_PERIOD_MS ((TickType_t)1000 / configTICK_RATE_HZ) -#define portBYTE_ALIGNMENT 16 -#define portPOINTER_SIZE_TYPE uint64_t - -/*-----------------------------------------------------------*/ - -/* Task utilities. */ - -/* Called at the end of an ISR that can cause a context switch. */ -#define portEND_SWITCHING_ISR(xSwitchRequired) \ - { \ - extern uint64_t ullPortYieldRequired; \ - \ - if (xSwitchRequired != pdFALSE) \ - { \ - ullPortYieldRequired = pdTRUE; \ - } \ - } - -#define portYIELD_FROM_ISR(x) portEND_SWITCHING_ISR(x) -#if defined(GUEST) -#define portYIELD() __asm volatile("SVC 0" :: \ - : "memory") -#else -#define portYIELD() __asm volatile("SMC 0" :: \ - : "memory") -#endif - /*----------------------------------------------------------- - * Critical section control - *----------------------------------------------------------*/ - - extern void vPortEnterCritical(void); - extern void vPortExitCritical(void); - extern UBaseType_t uxPortSetInterruptMask(void); - extern void vPortClearInterruptMask(UBaseType_t uxNewMaskValue); - extern void vPortInstallFreeRTOSVectorTable(void); - -#define portDISABLE_INTERRUPTS() \ - __asm volatile("MSR DAIFSET, #2" :: \ - : "memory"); \ - __asm volatile("DSB SY"); \ - __asm volatile("ISB SY"); - -#define portENABLE_INTERRUPTS() \ - __asm volatile("MSR DAIFCLR, #2" :: \ - : "memory"); \ - __asm volatile("DSB SY"); \ - __asm volatile("ISB SY"); - -/* These macros do not globally disable/enable interrupts. They do mask off -interrupts that have a priority below configMAX_API_CALL_INTERRUPT_PRIORITY. */ -#define portENTER_CRITICAL() vPortEnterCritical(); -#define portEXIT_CRITICAL() vPortExitCritical(); -#define portSET_INTERRUPT_MASK_FROM_ISR() uxPortSetInterruptMask() -#define portCLEAR_INTERRUPT_MASK_FROM_ISR(x) vPortClearInterruptMask(x) - -/*-----------------------------------------------------------*/ - -/* Task function macros as described on the FreeRTOS.org WEB site. These are -not required for this port but included in case common demo code that uses these -macros is used. */ -#define portTASK_FUNCTION_PROTO(vFunction, pvParameters) void vFunction(void *pvParameters) -#define portTASK_FUNCTION(vFunction, pvParameters) void vFunction(void *pvParameters) - - /* Prototype of the FreeRTOS tick handler. This must be installed as the -handler for whichever peripheral is used to generate the RTOS tick. */ - void FreeRTOS_Tick_Handler(void); - - /* Any task that uses the floating point unit MUST call vPortTaskUsesFPU() -before any floating point instructions are executed. */ - void vPortTaskUsesFPU(void); -#define portTASK_USES_FLOATING_POINT() vPortTaskUsesFPU() - -#define portLOWEST_INTERRUPT_PRIORITY (((uint32_t)configUNIQUE_INTERRUPT_PRIORITIES) - 1UL) -#define portLOWEST_USABLE_INTERRUPT_PRIORITY (portLOWEST_INTERRUPT_PRIORITY - 1UL) - -/* Architecture specific optimisations. */ -#ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION -#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 -#endif - -#if configUSE_PORT_OPTIMISED_TASK_SELECTION == 1 - -/* Store/clear the ready priorities in a bit map. */ -#define portRECORD_READY_PRIORITY(uxPriority, uxReadyPriorities) (uxReadyPriorities) |= (1UL << (uxPriority)) -#define portRESET_READY_PRIORITY(uxPriority, uxReadyPriorities) (uxReadyPriorities) &= ~(1UL << (uxPriority)) - - /*-----------------------------------------------------------*/ - -#define portGET_HIGHEST_PRIORITY(uxTopPriority, uxReadyPriorities) uxTopPriority = (31 - __builtin_clz(uxReadyPriorities)) - -#endif /* configUSE_PORT_OPTIMISED_TASK_SELECTION */ - -#ifdef configASSERT - void vPortValidateInterruptPriority(void); -#define portASSERT_IF_INTERRUPT_PRIORITY_INVALID() vPortValidateInterruptPriority() -#endif /* configASSERT */ - -#define portNOP() __asm volatile("NOP") -#define portINLINE __inline - -#ifdef __cplusplus -} /* extern C */ -#endif - -/* The number of bits to shift for an interrupt priority is dependent on the -number of bits implemented by the interrupt controller. */ -#if configUNIQUE_INTERRUPT_PRIORITIES == 16 -#define portPRIORITY_SHIFT 4 -#define portMAX_BINARY_POINT_VALUE 3 -#elif configUNIQUE_INTERRUPT_PRIORITIES == 32 -#define portPRIORITY_SHIFT 3 -#define portMAX_BINARY_POINT_VALUE 2 -#elif configUNIQUE_INTERRUPT_PRIORITIES == 64 -#define portPRIORITY_SHIFT 2 -#define portMAX_BINARY_POINT_VALUE 1 -#elif configUNIQUE_INTERRUPT_PRIORITIES == 128 -#define portPRIORITY_SHIFT 1 -#define portMAX_BINARY_POINT_VALUE 0 -#elif configUNIQUE_INTERRUPT_PRIORITIES == 256 -#define portPRIORITY_SHIFT 0 -#define portMAX_BINARY_POINT_VALUE 0 -#else -#error Invalid configUNIQUE_INTERRUPT_PRIORITIES setting. configUNIQUE_INTERRUPT_PRIORITIES must be set to the number of unique priorities implemented by the target hardware -#endif - -/* Interrupt controller access addresses. */ -#define portICCPMR_PRIORITY_MASK_OFFSET (0x04) -#define portICCIAR_INTERRUPT_ACKNOWLEDGE_OFFSET (0x0C) -#define portICCEOIR_END_OF_INTERRUPT_OFFSET (0x10) -#define portICCBPR_BINARY_POINT_OFFSET (0x08) -#define portICCRPR_RUNNING_PRIORITY_OFFSET (0x14) - -// #define portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS (GIC_GICC_BASE) -// #define portICCPMR_PRIORITY_MASK_REGISTER (*((volatile uint32_t *)(portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCPMR_PRIORITY_MASK_OFFSET))) -// #define portICCIAR_INTERRUPT_ACKNOWLEDGE_REGISTER_ADDRESS (portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCIAR_INTERRUPT_ACKNOWLEDGE_OFFSET) -// #define portICCEOIR_END_OF_INTERRUPT_REGISTER_ADDRESS (portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCEOIR_END_OF_INTERRUPT_OFFSET) -// #define portICCPMR_PRIORITY_MASK_REGISTER_ADDRESS (portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCPMR_PRIORITY_MASK_OFFSET) -// #define portICCBPR_BINARY_POINT_REGISTER (*((const volatile uint32_t *)(portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCBPR_BINARY_POINT_OFFSET))) -// #define portICCRPR_RUNNING_PRIORITY_REGISTER (*((const volatile uint32_t *)(portINTERRUPT_CONTROLLER_CPU_INTERFACE_ADDRESS + portICCRPR_RUNNING_PRIORITY_OFFSET))) - -#endif /* PORTMACRO_H */ -- Gitee From 4fad112c40843b36b4eae4c46d80e67694c8e5a3 Mon Sep 17 00:00:00 2001 From: wxd <15576600345@qq.com> Date: Wed, 22 Dec 2021 11:11:21 +0800 Subject: [PATCH 04/14] bak --- example/function_test/sdkconfig | 35 +++++++++++-------------------- example/function_test/sdkconfig.h | 34 +++++++++++------------------- make/complier.mk | 3 +++ 3 files changed, 27 insertions(+), 45 deletions(-) diff --git a/example/function_test/sdkconfig b/example/function_test/sdkconfig index bf666aa6..64fb610a 100644 --- a/example/function_test/sdkconfig +++ b/example/function_test/sdkconfig @@ -3,8 +3,6 @@ # Project Configuration # CONFIG_TARGET_NAME="ft2004_freertos" -#CONFIG_LWIP_POLL_TEST=y -# CONFIG_LWIP_INTRRUPT_TEST is not set # end of Project Configuration # @@ -39,7 +37,7 @@ CONFIG_TARGET_F2000_4=y # CONFIG_USE_SPI is not set # CONFIG_USE_QSPI is not set CONFIG_USE_GIC=y -CONFIG_EBABLE_GICV3=y +CONFIG_ENABLE_GICV3=y CONFIG_USE_SERIAL=y # @@ -55,15 +53,8 @@ CONFIG_USE_ETH=y # # Eth Configuration # -# CONFIG_ENABLE_F_XMAC is not set -CONFIG_ENABLE_F_GMAC=y - -# -# F_GMAC Configuration -# -# CONFIG_F_GMAC_PHY_COMMON is not set -CONFIG_F_GMAC_PHY_AR803X=y -# end of F_GMAC Configuration +# CONFIG_ENABLE_FXMAC is not set +# CONFIG_ENABLE_FGMAC is not set # end of Eth Configuration # CONFIG_USE_CAN is not set @@ -73,20 +64,23 @@ CONFIG_F_GMAC_PHY_AR803X=y # CONFIG_USE_PCIE is not set # CONFIG_USE_WDT is not set # CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set # end of Components Configuration -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set # end of Standalone Setting # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y # # Cross-Compiler Setting # CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 # CONFIG_USE_EXT_COMPILER is not set # end of Cross-Compiler Setting @@ -98,10 +92,11 @@ CONFIG_LOG_INFO=y # CONFIG_LOG_NONE is not set # -# GNU Linker Setting +# Linker Options # CONFIG_AARCH32_RAM_LD=y # CONFIG_AARCH64_RAM_LD is not set +# CONFIG_QEMU_AARCH32_RAM_LD is not set # CONFIG_USER_DEFINED_LD is not set CONFIG_LINK_SCRIPT_ROM=y CONFIG_ROM_START_UP_ADDR=0x80100000 @@ -111,7 +106,7 @@ CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 CONFIG_HEAP_SIZE=0x100000 CONFIG_STACK_SIZE=0x100000 -# end of GNU Linker Setting +# end of Linker Options # end of Building Option # @@ -128,11 +123,5 @@ CONFIG_FREERTOS_USE_UART=y # # FreeRTOS Setting # -#CONFIG_USE_LWIP=y - -# -# LWIP Configuration -# -#CONFIG_LWIP_F_GMAC=y -# end of LWIP Configuration +# CONFIG_USE_LWIP is not set # end of FreeRTOS Setting diff --git a/example/function_test/sdkconfig.h b/example/function_test/sdkconfig.h index 179f0cae..d98e8672 100644 --- a/example/function_test/sdkconfig.h +++ b/example/function_test/sdkconfig.h @@ -4,8 +4,6 @@ /* Project Configuration */ #define CONFIG_TARGET_NAME "ft2004_freertos" -/*CONFIG_LWIP_POLL_TEST=y */ -/* CONFIG_LWIP_INTRRUPT_TEST is not set */ /* end of Project Configuration */ /* Standalone Setting */ @@ -36,7 +34,7 @@ /* CONFIG_USE_SPI is not set */ /* CONFIG_USE_QSPI is not set */ #define CONFIG_USE_GIC -#define CONFIG_EBABLE_GICV3 +#define CONFIG_ENABLE_GICV3 #define CONFIG_USE_SERIAL /* Usart Configuration */ @@ -49,14 +47,8 @@ /* Eth Configuration */ -/* CONFIG_ENABLE_F_XMAC is not set */ -#define CONFIG_ENABLE_F_GMAC - -/* F_GMAC Configuration */ - -/* CONFIG_F_GMAC_PHY_COMMON is not set */ -#define CONFIG_F_GMAC_PHY_AR803X -/* end of F_GMAC Configuration */ +/* CONFIG_ENABLE_FXMAC is not set */ +/* CONFIG_ENABLE_FGMAC is not set */ /* end of Eth Configuration */ /* CONFIG_USE_CAN is not set */ /* CONFIG_USE_I2C is not set */ @@ -65,17 +57,19 @@ /* CONFIG_USE_PCIE is not set */ /* CONFIG_USE_WDT is not set */ /* CONFIG_USE_DMA is not set */ +/* CONFIG_USE_NAND is not set */ +/* CONFIG_USE_RTC is not set */ /* end of Components Configuration */ -#define CONFIG_USE_LIBC +#define CONFIG_USE_G_LIBC +/* CONFIG_USE_NEW_LIBC is not set */ /* end of Standalone Setting */ /* Building Option */ -#define CONFIG_ENVI_UBUNTU_20_04 - /* Cross-Compiler Setting */ #define CONFIG_COMPILER_NO_STD_STARUP +#define CONFIG_GCC_OPTIMIZE_LEVEL 0 /* CONFIG_USE_EXT_COMPILER is not set */ /* end of Cross-Compiler Setting */ /* CONFIG_LOG_VERBOS is not set */ @@ -85,10 +79,11 @@ /* CONFIG_LOG_ERROR is not set */ /* CONFIG_LOG_NONE is not set */ -/* GNU Linker Setting */ +/* Linker Options */ #define CONFIG_AARCH32_RAM_LD /* CONFIG_AARCH64_RAM_LD is not set */ +/* CONFIG_QEMU_AARCH32_RAM_LD is not set */ /* CONFIG_USER_DEFINED_LD is not set */ #define CONFIG_LINK_SCRIPT_ROM #define CONFIG_ROM_START_UP_ADDR 0x80100000 @@ -98,7 +93,7 @@ #define CONFIG_RAM_SIZE_MB 64 #define CONFIG_HEAP_SIZE 0x100000 #define CONFIG_STACK_SIZE 0x100000 -/* end of GNU Linker Setting */ +/* end of Linker Options */ /* end of Building Option */ /* Component Configuration */ @@ -111,12 +106,7 @@ /* FreeRTOS Setting */ -/*CONFIG_USE_LWIP=y */ - -/* LWIP Configuration */ - -/*CONFIG_LWIP_F_GMAC=y */ -/* end of LWIP Configuration */ +/* CONFIG_USE_LWIP is not set */ /* end of FreeRTOS Setting */ #endif diff --git a/make/complier.mk b/make/complier.mk index e874333d..ef8500a5 100755 --- a/make/complier.mk +++ b/make/complier.mk @@ -135,6 +135,7 @@ ifdef CONFIG_USE_G_LIBC LDFLAGS += -lgcc -L $(LIBPATH) INC_DIR := $(INC_DIR) $(CROSS_PATH)/arm-none-eabi/include OBJ_FILES += $(CROSS_PATH)/arm-none-eabi/lib/thumb/v7/nofp/libc.a \ + $(CROSS_PATH)/arm-none-eabi/lib/thumb/v7/nofp/libm.a \ $(CROSS_PATH)/lib/gcc/arm-none-eabi/$(CC_VERSION)/libgcc.a endif endif @@ -146,6 +147,7 @@ ifdef CONFIG_USE_NEW_LIBC LIBPATH := $(CROSS_PATH)/newlib/arm-none-eabi/newlib INC_DIR := $(INC_DIR) $(CROSS_PATH)/newlib/newlib/libc/include OBJ_FILES += $(CROSS_PATH)/newlib/arm-none-eabi/newlib/libc.a \ + $(CROSS_PATH)/newlib/arm-none-eabi/newlib/libm.a \ $(CROSS_PATH)/lib/gcc/arm-none-eabi/$(CC_VERSION)/libgcc.a endif @@ -153,6 +155,7 @@ ifdef CONFIG_USE_NEW_LIBC LIBPATH := $(CROSS_PATH)/newlib/aarch64-none-elf/newlib INC_DIR := $(INC_DIR) $(CROSS_PATH)/newlib/newlib/libc/include OBJ_FILES += $(CROSS_PATH)/newlib/aarch64-none-elf/newlib/libc.a \ + $(CROSS_PATH)/newlib/aarch64-none-elf/newlib/libm.a \ $(CROSS_PATH)/lib/gcc/aarch64-none-elf/$(CC_VERSION)/libgcc.a endif -- Gitee From 55573849c8ad8fd4f67da132ef3e962095d6d6d3 Mon Sep 17 00:00:00 2001 From: wxd <15576600345@qq.com> Date: Thu, 23 Dec 2021 13:53:19 +0800 Subject: [PATCH 05/14] lwip ok --- .vscode/settings.json | 7 +- configs/d2000_aarch32_defconfig | 2 +- configs/d2000_aarch64_defconfig | 2 +- configs/ft2004_aarch32_defconfig | 2 +- configs/ft2004_aarch64_defconfig | 2 +- example/freertos_test/sdkconfig | 2 +- example/freertos_test/sdkconfig.h | 2 +- .../configs/ft2004_aarch32_eg_configs | 131 ++++++++++ .../configs/ft2004_aarch64_eg_configs | 125 +++++++++ example/function_test/sdkconfig | 9 +- example/function_test/sdkconfig.h | 9 +- example/hello_world/sdkconfig | 2 +- example/hello_world/sdkconfig.h | 2 +- .../configs/ft2004_aarch32_eg_configs | 141 ++++++++++ .../configs/ft2004_aarch64_eg_configs | 135 ++++++++++ example/lwip_test/sdkconfig | 12 +- example/lwip_test/sdkconfig.h | 12 +- example/lwip_test/test_lwip.c | 6 +- example/start_up/sdkconfig | 2 +- example/start_up/sdkconfig.h | 2 +- example/template/sdkconfig | 2 +- example/template/sdkconfig.h | 2 +- install.py | 2 +- make/build_all.mk | 74 ++++++ make/build_freertos.mk | 3 +- .../freertos/portable/freertos_configs.c | 33 ++- third-party/freertos/timers.c | 3 +- third-party/lwip-2.1.2/Kconfig | 2 +- .../lwip-2.1.2/ports/f_gmac/ethernetif.c | 162 ++++++------ .../lwip-2.1.2/ports/f_gmac/ft_os_gmac.c | 244 ++++++++++++++++-- .../lwip-2.1.2/ports/f_gmac/ft_os_gmac.h | 15 +- third-party/third-party.mk | 2 +- 32 files changed, 987 insertions(+), 164 deletions(-) create mode 100644 example/function_test/configs/ft2004_aarch32_eg_configs create mode 100644 example/function_test/configs/ft2004_aarch64_eg_configs create mode 100644 example/lwip_test/configs/ft2004_aarch32_eg_configs create mode 100644 example/lwip_test/configs/ft2004_aarch64_eg_configs create mode 100644 make/build_all.mk diff --git a/.vscode/settings.json b/.vscode/settings.json index d67f2f7b..c17b3cc0 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -42,6 +42,11 @@ "semphr.h": "c", "portmacro.h": "c", "fwdt.h": "c", - "fpl011.h": "c" + "fpl011.h": "c", + "lwipopts.h": "c", + "errno.h": "c", + "dhcp.h": "c", + "fgmac_hw.h": "c", + "fgmac.h": "c" } } \ No newline at end of file diff --git a/configs/d2000_aarch32_defconfig b/configs/d2000_aarch32_defconfig index 15b70295..9ade1d8c 100644 --- a/configs/d2000_aarch32_defconfig +++ b/configs/d2000_aarch32_defconfig @@ -54,7 +54,7 @@ CONFIG_USE_ETH=y # Eth Configuration # # CONFIG_ENABLE_F_XMAC is not set -CONFIG_ENABLE_F_GMAC=y +CONFIG_ENABLE_FGMAC=y # # F_GMAC Configuration diff --git a/configs/d2000_aarch64_defconfig b/configs/d2000_aarch64_defconfig index 9471b8bd..e048ca5d 100644 --- a/configs/d2000_aarch64_defconfig +++ b/configs/d2000_aarch64_defconfig @@ -55,7 +55,7 @@ CONFIG_USE_ETH=y # Eth Configuration # # CONFIG_ENABLE_F_XMAC is not set -CONFIG_ENABLE_F_GMAC=y +CONFIG_ENABLE_FGMAC=y # # F_GMAC Configuration diff --git a/configs/ft2004_aarch32_defconfig b/configs/ft2004_aarch32_defconfig index 3e86c995..0e523ebe 100644 --- a/configs/ft2004_aarch32_defconfig +++ b/configs/ft2004_aarch32_defconfig @@ -56,7 +56,7 @@ CONFIG_USE_ETH=y # Eth Configuration # # CONFIG_ENABLE_F_XMAC is not set -CONFIG_ENABLE_F_GMAC=y +CONFIG_ENABLE_FGMAC=y # # F_GMAC Configuration diff --git a/configs/ft2004_aarch64_defconfig b/configs/ft2004_aarch64_defconfig index 84c05b88..01f5e62a 100644 --- a/configs/ft2004_aarch64_defconfig +++ b/configs/ft2004_aarch64_defconfig @@ -54,7 +54,7 @@ CONFIG_USE_ETH=y # Eth Configuration # # CONFIG_ENABLE_F_XMAC is not set -CONFIG_ENABLE_F_GMAC=y +CONFIG_ENABLE_FGMAC=y # # F_GMAC Configuration diff --git a/example/freertos_test/sdkconfig b/example/freertos_test/sdkconfig index a4853dd5..6210f59a 100644 --- a/example/freertos_test/sdkconfig +++ b/example/freertos_test/sdkconfig @@ -48,7 +48,7 @@ CONFIG_USE_ETH=y # Eth Configuration # # CONFIG_ENABLE_F_XMAC is not set -CONFIG_ENABLE_F_GMAC=y +CONFIG_ENABLE_FGMAC=y # # F_GMAC Configuration diff --git a/example/freertos_test/sdkconfig.h b/example/freertos_test/sdkconfig.h index 76216d09..d9f2ab5f 100644 --- a/example/freertos_test/sdkconfig.h +++ b/example/freertos_test/sdkconfig.h @@ -44,7 +44,7 @@ /* Eth Configuration */ /* CONFIG_ENABLE_F_XMAC is not set */ -#define CONFIG_ENABLE_F_GMAC +#define CONFIG_ENABLE_FGMAC /* F_GMAC Configuration */ diff --git a/example/function_test/configs/ft2004_aarch32_eg_configs b/example/function_test/configs/ft2004_aarch32_eg_configs new file mode 100644 index 00000000..6b27537c --- /dev/null +++ b/example/function_test/configs/ft2004_aarch32_eg_configs @@ -0,0 +1,131 @@ + +# +# Project Configuration +# +CONFIG_TARGET_NAME="ft2004_freertos" +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +CONFIG_TARGET_ARMV8_AARCH32=y +# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arch Configuration + +# +# Board Configuration +# +CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_E2000 is not set +# CONFIG_TARGET_D2000 is not set +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +# CONFIG_ENABLE_FGMAC is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +CONFIG_AARCH32_RAM_LD=y +# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/function_test/configs/ft2004_aarch64_eg_configs b/example/function_test/configs/ft2004_aarch64_eg_configs new file mode 100644 index 00000000..8c69a958 --- /dev/null +++ b/example/function_test/configs/ft2004_aarch64_eg_configs @@ -0,0 +1,125 @@ + +# +# Project Configuration +# +CONFIG_TARGET_NAME="ft2004_freertos" +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +# end of Arch Configuration + +# +# Board Configuration +# +CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_E2000 is not set +# CONFIG_TARGET_D2000 is not set +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +# CONFIG_ENABLE_FGMAC is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/function_test/sdkconfig b/example/function_test/sdkconfig index 5985fd92..8c69a958 100644 --- a/example/function_test/sdkconfig +++ b/example/function_test/sdkconfig @@ -25,9 +25,9 @@ CONFIG_USE_SYS_TICK=y # # Board Configuration # -# CONFIG_TARGET_F2000_4 is not set +CONFIG_TARGET_F2000_4=y # CONFIG_TARGET_E2000 is not set -CONFIG_TARGET_D2000=y +# CONFIG_TARGET_D2000 is not set # end of Board Configuration # @@ -95,7 +95,6 @@ CONFIG_LOG_INFO=y # # CONFIG_AARCH32_RAM_LD is not set CONFIG_AARCH64_RAM_LD=y -# CONFIG_QEMU_AARCH32_RAM_LD is not set # CONFIG_USER_DEFINED_LD is not set CONFIG_LINK_SCRIPT_ROM=y CONFIG_ROM_START_UP_ADDR=0x80100000 @@ -103,8 +102,8 @@ CONFIG_ROM_SIZE_MB=1 CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 -CONFIG_HEAP_SIZE=0x100000 -CONFIG_STACK_SIZE=0x100000 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 # end of Linker Options # end of Building Option diff --git a/example/function_test/sdkconfig.h b/example/function_test/sdkconfig.h index fdbcb042..d3949427 100644 --- a/example/function_test/sdkconfig.h +++ b/example/function_test/sdkconfig.h @@ -23,9 +23,9 @@ /* Board Configuration */ -/* CONFIG_TARGET_F2000_4 is not set */ +#define CONFIG_TARGET_F2000_4 /* CONFIG_TARGET_E2000 is not set */ -#define CONFIG_TARGET_D2000 +/* CONFIG_TARGET_D2000 is not set */ /* end of Board Configuration */ /* Components Configuration */ @@ -82,7 +82,6 @@ /* CONFIG_AARCH32_RAM_LD is not set */ #define CONFIG_AARCH64_RAM_LD -/* CONFIG_QEMU_AARCH32_RAM_LD is not set */ /* CONFIG_USER_DEFINED_LD is not set */ #define CONFIG_LINK_SCRIPT_ROM #define CONFIG_ROM_START_UP_ADDR 0x80100000 @@ -90,8 +89,8 @@ #define CONFIG_LINK_SCRIPT_RAM #define CONFIG_RAM_START_UP_ADDR 0x81000000 #define CONFIG_RAM_SIZE_MB 64 -#define CONFIG_HEAP_SIZE 0x100000 -#define CONFIG_STACK_SIZE 0x100000 +#define CONFIG_HEAP_SIZE 1 +#define CONFIG_STACK_SIZE 0x400 /* end of Linker Options */ /* end of Building Option */ diff --git a/example/hello_world/sdkconfig b/example/hello_world/sdkconfig index bf666aa6..b8736200 100644 --- a/example/hello_world/sdkconfig +++ b/example/hello_world/sdkconfig @@ -56,7 +56,7 @@ CONFIG_USE_ETH=y # Eth Configuration # # CONFIG_ENABLE_F_XMAC is not set -CONFIG_ENABLE_F_GMAC=y +CONFIG_ENABLE_FGMAC=y # # F_GMAC Configuration diff --git a/example/hello_world/sdkconfig.h b/example/hello_world/sdkconfig.h index 179f0cae..c3d96bf2 100644 --- a/example/hello_world/sdkconfig.h +++ b/example/hello_world/sdkconfig.h @@ -50,7 +50,7 @@ /* Eth Configuration */ /* CONFIG_ENABLE_F_XMAC is not set */ -#define CONFIG_ENABLE_F_GMAC +#define CONFIG_ENABLE_FGMAC /* F_GMAC Configuration */ diff --git a/example/lwip_test/configs/ft2004_aarch32_eg_configs b/example/lwip_test/configs/ft2004_aarch32_eg_configs new file mode 100644 index 00000000..a7827f82 --- /dev/null +++ b/example/lwip_test/configs/ft2004_aarch32_eg_configs @@ -0,0 +1,141 @@ + +# +# Project Configuration +# +CONFIG_TARGET_NAME="ft2004_freertos" +CONFIG_LWIP_POLL_TEST=y +# CONFIG_LWIP_INTRRUPT_TEST is not set +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +CONFIG_TARGET_ARMV8_AARCH32=y +# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arch Configuration + +# +# Board Configuration +# +CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_E2000 is not set +# CONFIG_TARGET_D2000 is not set +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +# CONFIG_LOG_INFO is not set +CONFIG_LOG_WARN=y +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +CONFIG_AARCH32_RAM_LD=y +# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +CONFIG_USE_LWIP=y + +# +# LWIP Configuration +# +CONFIG_LWIP_F_GMAC=y +# end of LWIP Configuration +# end of FreeRTOS Setting diff --git a/example/lwip_test/configs/ft2004_aarch64_eg_configs b/example/lwip_test/configs/ft2004_aarch64_eg_configs new file mode 100644 index 00000000..b9008a9e --- /dev/null +++ b/example/lwip_test/configs/ft2004_aarch64_eg_configs @@ -0,0 +1,135 @@ + +# +# Project Configuration +# +CONFIG_TARGET_NAME="ft2004_freertos" +CONFIG_LWIP_POLL_TEST=y +# CONFIG_LWIP_INTRRUPT_TEST is not set +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +# end of Arch Configuration + +# +# Board Configuration +# +CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_E2000 is not set +# CONFIG_TARGET_D2000 is not set +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +# CONFIG_LOG_INFO is not set +CONFIG_LOG_WARN=y +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +CONFIG_USE_LWIP=y + +# +# LWIP Configuration +# +CONFIG_LWIP_F_GMAC=y +# end of LWIP Configuration +# end of FreeRTOS Setting diff --git a/example/lwip_test/sdkconfig b/example/lwip_test/sdkconfig index 36bc0c82..b9008a9e 100644 --- a/example/lwip_test/sdkconfig +++ b/example/lwip_test/sdkconfig @@ -27,9 +27,9 @@ CONFIG_USE_SYS_TICK=y # # Board Configuration # -# CONFIG_TARGET_F2000_4 is not set +CONFIG_TARGET_F2000_4=y # CONFIG_TARGET_E2000 is not set -CONFIG_TARGET_D2000=y +# CONFIG_TARGET_D2000 is not set # end of Board Configuration # @@ -55,7 +55,9 @@ CONFIG_USE_ETH=y # Eth Configuration # # CONFIG_ENABLE_FXMAC is not set -# CONFIG_ENABLE_FGMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set # end of Eth Configuration # CONFIG_USE_CAN is not set @@ -87,8 +89,8 @@ CONFIG_GCC_OPTIMIZE_LEVEL=0 # CONFIG_LOG_VERBOS is not set # CONFIG_LOG_DEBUG is not set -CONFIG_LOG_INFO=y -# CONFIG_LOG_WARN is not set +# CONFIG_LOG_INFO is not set +CONFIG_LOG_WARN=y # CONFIG_LOG_ERROR is not set # CONFIG_LOG_NONE is not set diff --git a/example/lwip_test/sdkconfig.h b/example/lwip_test/sdkconfig.h index 294574c2..261a5cc2 100644 --- a/example/lwip_test/sdkconfig.h +++ b/example/lwip_test/sdkconfig.h @@ -25,9 +25,9 @@ /* Board Configuration */ -/* CONFIG_TARGET_F2000_4 is not set */ +#define CONFIG_TARGET_F2000_4 /* CONFIG_TARGET_E2000 is not set */ -#define CONFIG_TARGET_D2000 +/* CONFIG_TARGET_D2000 is not set */ /* end of Board Configuration */ /* Components Configuration */ @@ -49,7 +49,9 @@ /* Eth Configuration */ /* CONFIG_ENABLE_FXMAC is not set */ -/* CONFIG_ENABLE_FGMAC is not set */ +#define CONFIG_ENABLE_FGMAC +#define CONFIG_FGMAC_PHY_COMMON +/* CONFIG_FGMAC_PHY_AR803X is not set */ /* end of Eth Configuration */ /* CONFIG_USE_CAN is not set */ /* CONFIG_USE_I2C is not set */ @@ -75,8 +77,8 @@ /* end of Cross-Compiler Setting */ /* CONFIG_LOG_VERBOS is not set */ /* CONFIG_LOG_DEBUG is not set */ -#define CONFIG_LOG_INFO -/* CONFIG_LOG_WARN is not set */ +/* CONFIG_LOG_INFO is not set */ +#define CONFIG_LOG_WARN /* CONFIG_LOG_ERROR is not set */ /* CONFIG_LOG_NONE is not set */ diff --git a/example/lwip_test/test_lwip.c b/example/lwip_test/test_lwip.c index eb495493..a9f75863 100644 --- a/example/lwip_test/test_lwip.c +++ b/example/lwip_test/test_lwip.c @@ -22,11 +22,11 @@ #error "Please include sdkconfig.h first" #endif -#ifndef CONFIG_ENABLE_F_GMAC +#ifndef CONFIG_ENABLE_FGMAC #error "Please include component f_gmac first" #endif -#include "gmac.h" +#include "fgmac.h" #include "lwip/ip4_addr.h" #include "lwip/init.h" #include "netif/ethernet.h" @@ -55,7 +55,7 @@ struct ethernetif { struct eth_addr *ethaddr; - GmacCtrl *ethctrl; + FGmac *ethctrl; }; static ip4_addr_t ip_addr, net_mask, gate_way; diff --git a/example/start_up/sdkconfig b/example/start_up/sdkconfig index bf666aa6..b8736200 100644 --- a/example/start_up/sdkconfig +++ b/example/start_up/sdkconfig @@ -56,7 +56,7 @@ CONFIG_USE_ETH=y # Eth Configuration # # CONFIG_ENABLE_F_XMAC is not set -CONFIG_ENABLE_F_GMAC=y +CONFIG_ENABLE_FGMAC=y # # F_GMAC Configuration diff --git a/example/start_up/sdkconfig.h b/example/start_up/sdkconfig.h index 179f0cae..c3d96bf2 100644 --- a/example/start_up/sdkconfig.h +++ b/example/start_up/sdkconfig.h @@ -50,7 +50,7 @@ /* Eth Configuration */ /* CONFIG_ENABLE_F_XMAC is not set */ -#define CONFIG_ENABLE_F_GMAC +#define CONFIG_ENABLE_FGMAC /* F_GMAC Configuration */ diff --git a/example/template/sdkconfig b/example/template/sdkconfig index bf666aa6..b8736200 100644 --- a/example/template/sdkconfig +++ b/example/template/sdkconfig @@ -56,7 +56,7 @@ CONFIG_USE_ETH=y # Eth Configuration # # CONFIG_ENABLE_F_XMAC is not set -CONFIG_ENABLE_F_GMAC=y +CONFIG_ENABLE_FGMAC=y # # F_GMAC Configuration diff --git a/example/template/sdkconfig.h b/example/template/sdkconfig.h index 179f0cae..c3d96bf2 100644 --- a/example/template/sdkconfig.h +++ b/example/template/sdkconfig.h @@ -50,7 +50,7 @@ /* Eth Configuration */ /* CONFIG_ENABLE_F_XMAC is not set */ -#define CONFIG_ENABLE_F_GMAC +#define CONFIG_ENABLE_FGMAC /* F_GMAC Configuration */ diff --git a/install.py b/install.py index 1beee322..e03dcebe 100644 --- a/install.py +++ b/install.py @@ -86,7 +86,7 @@ os.system("chmod +x ./make/*.mk --silent ") os.system("chmod +x ./lib/Kconfiglib/*.py --silent ") # Add standalone sdk -standalone_sdk_v="v0.1.8" +standalone_sdk_v="v0.1.15" standalone_path=freertos_sdk_path + '/standalone' standalone_branche="master" standalone_remote="https://gitee.com/phytium_embedded/phytium-standalone-sdk.git" diff --git a/make/build_all.mk b/make/build_all.mk new file mode 100644 index 00000000..66b4c72d --- /dev/null +++ b/make/build_all.mk @@ -0,0 +1,74 @@ +# /* +# * @ : Copyright (c) 2021 Phytium Information Technology, Inc. +# * +# * SPDX-License-Identifier: Apache-2.0. +# * +# * @Date: 2021-10-28 14:51:27 +# * @LastEditTime: 2021-10-28 15:04:55 +# * @Description:  This files is for build images for all platform +# * +# * @Modify History: +# * Ver   Who        Date         Changes +# * ----- ------     --------    -------------------------------------- +# */ + +EG_CONFIGS_DIR := ./configs + + +# 根据例程默认,编译各平台的镜像 +.PHONY: load_e2000_aarch32 load_e2000_aarch64 backup_kconfig + +load_ft2004_aarch32: + @echo "========Load for FT2000/4 AARCH32 Start=============" + make ldconfig LDCONFIG_ARG=$(EG_CONFIGS_DIR)/ft2004_aarch32_eg_configs + @echo "==============FT2000/4 AARCH32=======================" + +load_ft2004_aarch64: + @echo "=======Load for FT2000/4 AARCH64 Start===============" + make ldconfig LDCONFIG_ARG=$(EG_CONFIGS_DIR)/ft2004_aarch64_eg_configs + @echo "==============FT2000/4 AARCH64=======================" + +load_d2000_aarch32: + @echo "=======Load for D2000 AARCH32====================" + make ldconfig LDCONFIG_ARG=$(EG_CONFIGS_DIR)/d2000_aarch32_eg_configs + @echo "==============D2000 AARCH32=======================" + +load_d2000_aarch64: + @echo "========Load for D2000 AARCH64===================" + make ldconfig LDCONFIG_ARG=$(EG_CONFIGS_DIR)/d2000_aarch64_eg_configs + @echo "==============D2000 AARCH64=========================" + +load_e2000_aarch32: + @echo "=======Load for E2000 AARCH32====================" + make ldconfig LDCONFIG_ARG=$(EG_CONFIGS_DIR)/e2000_aarch32_eg_configs + @echo "==============E2000 AARCH32=======================" + +load_e2000_aarch64: + @echo "========Load for E2000 AARCH64===================" + make ldconfig LDCONFIG_ARG=$(EG_CONFIGS_DIR)/e2000_aarch64_eg_configs + @echo "==============E2000 AARCH64=========================" + +backup_kconfig: +ifdef CONFIG_TARGET_ARMV8_AARCH32 +ifdef CONFIG_TARGET_D2000 + cp sdkconfig ./configs/d2000_aarch32_eg_configs +endif +ifdef CONFIG_TARGET_F2000_4 + cp sdkconfig ./configs/ft2004_aarch32_eg_configs +endif +ifdef CONFIG_TARGET_E2000 + cp sdkconfig ./configs/e2000_aarch32_eg_configs +endif +endif + +ifdef CONFIG_TARGET_ARMV8_AARCH64 +ifdef CONFIG_TARGET_D2000 + cp sdkconfig ./configs/d2000_aarch64_eg_configs +endif +ifdef CONFIG_TARGET_F2000_4 + cp sdkconfig ./configs/ft2004_aarch64_eg_configs +endif +ifdef CONFIG_TARGET_E2000 + cp sdkconfig ./configs/e2000_aarch64_eg_configs +endif +endif \ No newline at end of file diff --git a/make/build_freertos.mk b/make/build_freertos.mk index 9eeb9548..aafbaedd 100755 --- a/make/build_freertos.mk +++ b/make/build_freertos.mk @@ -8,4 +8,5 @@ include $(FREERTOS_SDK_ROOT)/make/preconfig.mk include $(FREERTOS_SDK_ROOT)/make/complier.mk include $(FREERTOS_SDK_ROOT)/make/buildinfo.mk include $(FREERTOS_SDK_ROOT)/make/packsource.mk -include $(FREERTOS_SDK_ROOT)/make/menuconfig.mk \ No newline at end of file +include $(FREERTOS_SDK_ROOT)/make/menuconfig.mk +include $(FREERTOS_SDK_ROOT)/make/build_all.mk \ No newline at end of file diff --git a/third-party/freertos/portable/freertos_configs.c b/third-party/freertos/portable/freertos_configs.c index 0e40b912..2e81801c 100644 --- a/third-party/freertos/portable/freertos_configs.c +++ b/third-party/freertos/portable/freertos_configs.c @@ -75,9 +75,32 @@ void vClearTickInterrupt(void) GenericTimerCompare(cntfrq / configTICK_RATE_HZ); } + +static void vFIrqHandler(int ir) +{ + void *param; + IrqHandler isr_func; + extern struct IrqDesc isr_table[]; + + /* get interrupt service routine */ + isr_func = isr_table[ir].handler; + if (isr_func) + { + /* Interrupt for myself. */ + param = isr_table[ir].param; + /* turn to interrupt service routine */ + isr_func(ir, param); + } + /* end of interrupt */ + InterruptAck(ir); +} + volatile unsigned int gCpuRuntime; #ifdef __aarch64__ + +extern void IRQInterrupt(void *value); + void vApplicationIRQHandler(uint32_t ulICCIAR) { int ulInterruptID; @@ -96,9 +119,9 @@ void vApplicationIRQHandler(uint32_t ulICCIAR) } else { - printf("IRQInterrupt is exit \r\n") ; - // SystemIrqHandler(ulInterruptID); - IRQInterrupt(NULL) ; + // printf("IRQInterrupt is exit \r\n") ; + // IRQInterrupt(NULL) ; + vFIrqHandler(ulInterruptID); } } #else @@ -123,7 +146,9 @@ void vApplicationFPUSafeIRQHandler(uint32_t ulICCIAR) } else { - IrqInterruptHandler(); + // printf("IRQInterrupt is exit ulInterruptID=%d \r\n", ulInterruptID) ; + // IrqInterruptHandler(); + vFIrqHandler(ulInterruptID); } } #endif diff --git a/third-party/freertos/timers.c b/third-party/freertos/timers.c index 37b445b4..92bfb540 100644 --- a/third-party/freertos/timers.c +++ b/third-party/freertos/timers.c @@ -27,6 +27,7 @@ /* Standard includes. */ #include +#include /* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining all the API functions to use the MPU wrappers. That should only be done when @@ -504,7 +505,7 @@ static void prvTimerTask(void *pvParameters) /* Just to avoid compiler warnings. */ (void)pvParameters; - printf("prvTimerTask \r\n") ; + #if (configUSE_DAEMON_TASK_STARTUP_HOOK == 1) { extern void vApplicationDaemonTaskStartupHook(void); diff --git a/third-party/lwip-2.1.2/Kconfig b/third-party/lwip-2.1.2/Kconfig index 55d80f8a..936a7e74 100644 --- a/third-party/lwip-2.1.2/Kconfig +++ b/third-party/lwip-2.1.2/Kconfig @@ -7,7 +7,7 @@ menu "LWIP Configuration" config LWIP_F_GMAC select USE_ETH - select ENABLE_F_GMAC + select ENABLE_FGMAC bool "F_GMAC" endchoice # LWIP_GMAC_CTRL_TYPE diff --git a/third-party/lwip-2.1.2/ports/f_gmac/ethernetif.c b/third-party/lwip-2.1.2/ports/f_gmac/ethernetif.c index 1a7884ec..7758fa44 100644 --- a/third-party/lwip-2.1.2/ports/f_gmac/ethernetif.c +++ b/third-party/lwip-2.1.2/ports/f_gmac/ethernetif.c @@ -43,11 +43,10 @@ #include "parameters.h" #include "ft_os_gmac.h" -#include "gmac.h" -#include "gmac_hw.h" -#include "phy_common.h" +#include "fgmac.h" #include "ft_assert.h" +#include "interrupt.h" #ifndef SDK_CONFIG_H__ #error "Please include sdkconfig.h first" @@ -57,8 +56,7 @@ #error "Please enable system tick by CONFIG_USE_SYS_TICK first" #endif #include "generic_timer.h" -#include "gmac.h" -#include "gmac_dma.h" +#include "fgmac.h" #include "ft_debug.h" /* The time to block waiting for input. */ @@ -77,6 +75,8 @@ #define ETHNETIF_DEBUG_E(format, ...) FT_DEBUG_PRINT_E(ETHNETIF_DEBUG_TAG, format, ##__VA_ARGS__) #define ETHNETIF_DEBUG_W(format, ...) FT_DEBUG_PRINT_W(ETHNETIF_DEBUG_TAG, format, ##__VA_ARGS__) +extern FError FGmacWritePhyReg(FGmacPhy *instance_p, u16 phy_reg, u32 phy_reg_val); +extern FError FGmacReadPhyReg(FGmacPhy *instance_p, u16 phy_reg, u32 *phy_reg_val_p); /** * Helper struct to hold private data used to operate your ethernet interface. @@ -86,45 +86,32 @@ */ struct ethernetif { struct eth_addr *ethaddr; - GmacCtrl *ethctrl; + FGmac *ethctrl; }; -static GmacCtrl gctrl; /* huge size ctrl block */ +static FGmac gctrl; /* huge size ctrl block */ +static FGmacPhy phy; + static struct ethernetif netifctrl; /* align buf and descriptor by 128 */ -static u8 txBuf[GMAC_TX_DESCNUM * GMAC_MAX_PACKET_SIZE] __aligned(GMAC_DMA_MIN_ALIGN); -static u8 rxBuf[GMAC_RX_DESCNUM * GMAC_MAX_PACKET_SIZE] __aligned(GMAC_DMA_MIN_ALIGN); -static GmacDmaDesc txDesc[GMAC_TX_DESCNUM] __aligned(GMAC_DMA_MIN_ALIGN); -static GmacDmaDesc rxDesc[GMAC_RX_DESCNUM] __aligned(GMAC_DMA_MIN_ALIGN); +static u8 tx_buf[GMAC_TX_DESCNUM * GMAC_MAX_PACKET_SIZE] __aligned(GMAC_DMA_MIN_ALIGN); +static u8 rx_buf[GMAC_RX_DESCNUM * GMAC_MAX_PACKET_SIZE] __aligned(GMAC_DMA_MIN_ALIGN); +static FGmacDmaDesc tx_desc[GMAC_TX_DESCNUM] __aligned(GMAC_DMA_MIN_ALIGN); +static FGmacDmaDesc rx_desc[GMAC_RX_DESCNUM] __aligned(GMAC_DMA_MIN_ALIGN); + + /** * @name: eth_ctrl_init * @msg: config gmac and initialization * @return {*} - * @param {GmacCtrl} *pctrl + * @param {FGmac} *pctrl */ -static u32 eth_ctrl_init(GmacCtrl *pctrl) +u32 eth_ctrl_init(FGmac *pctrl) { LWIP_ASSERT("pctrl != NULL", (pctrl != NULL)); - u32 ret = GMAC_SUCCESS; - - memset(pctrl, 0U, sizeof(GmacCtrl)); - ret = GmacCfgInitialize(pctrl, GmacLookupConfig(GMAC_INSTANCE_0)); - LWIP_ERROR("eth_ctrl_init: init cfg failed\n", (GMAC_SUCCESS == ret), return ERR_IF); - - ret = GmacHwInitialize(pctrl); - LWIP_ERROR("eth_ctrl_init: init hardware failed\n", (GMAC_SUCCESS == ret), return ERR_IF); - - ret |= GmacDmaInitRxDescRing(pctrl, &rxDesc[0], &rxBuf[0], - GMAC_MAX_PACKET_SIZE, GMAC_RX_DESCNUM); - ret |= GmacDmaInitTxDescRing(pctrl, &txDesc[0], &txBuf[0], - GMAC_MAX_PACKET_SIZE, GMAC_TX_DESCNUM); - LWIP_ERROR("eth_ctrl_init: init hardware failed\n", (GMAC_SUCCESS == ret), return ERR_IF); - - ret = GmacIntrInit(pctrl); - LWIP_ERROR("eth_ctrl_init: init gmac intrrupt failed\n", (GMAC_SUCCESS == ret), return ERR_IF); - + u32 ret = FGMAC_SUCCESS; return ret; } @@ -140,16 +127,12 @@ void ethernet_link_thread(void *argument) for (;;) { - // printf("line=%d, ev=%#x, Flg=%d \r\n", __LINE__, ev, flag); ev = xEventGroupWaitBits(os_gmac_ptr->s_status_event, FT_NETIF_LINKUP | FT_NETIF_DOWN, pdTRUE, pdFALSE, portMAX_DELAY); - printf("line=%d, ev=%#x, Flg=%d \r\n", __LINE__, ev, flag); - if (ev & FT_NETIF_DOWN) { - // Ft_Os_Gmac_Stop(Os_GmacPtr); netif_set_link_down(netif); netif_set_down(netif); last_status = FT_NETIF_DOWN; @@ -163,12 +146,10 @@ void ethernet_link_thread(void *argument) } else { - ETHNETIF_DEBUG_I(" EventGroup is error \r\n"); + ETHNETIF_DEBUG_I("EventGroup is error \r\n"); FT_ASSERTVOIDALWAYS(); } - printf("ev=%#x, Flg=%d \r\n", ev, flag); - if (flag) { flag = 0; @@ -192,9 +173,7 @@ void GmacReceiveCallBack(void *args) { FtOsGmac *os_gmac_ptr; os_gmac_ptr = (FtOsGmac *)args; - //ETHNETIF_DEBUG_E(" Gmac_ReceiveCallBack \r\n"); xSemaphoreGiveFromISR(os_gmac_ptr->s_semaphore, 0); - } @@ -237,34 +216,36 @@ static void low_level_init(struct netif *netif) { u32 reg_value = 0; LWIP_ASSERT("netif != NULL", (netif != NULL)); - u32 ret = GMAC_SUCCESS; - - GmacCtrl *p_ctrl; - + u32 ret = FGMAC_SUCCESS; + FGmacMacAddr mac_addr; + FGmac *p_ctrl; FtOsGmac *os_gmac_ptr; os_gmac_ptr = container_of(netif, FtOsGmac, netif_object); - // GmacCtrl *p_ctrl; p_ctrl = &os_gmac_ptr->gmac; /* Init Gmac */ - FtOsGmacInit(os_gmac_ptr); + FtOsGmacInit(os_gmac_ptr, &phy); - /* Set Receive Callback */ - GmacRegisterEvtHandler(p_ctrl, GMAC_RX_COMPLETE_EVT, GmacReceiveCallBack); + /* Set Receive Callback */ + FGmacRegisterEvtHandler(p_ctrl, FGMAC_RX_COMPLETE_EVT, GmacReceiveCallBack); #if LWIP_ARP || LWIP_ETHERNET /* set MAC hardware address length */ netif->hwaddr_len = ETH_HWADDR_LEN; + /* set MAC hardware address */ + memset(mac_addr, 0, sizeof(mac_addr)); + FGmacGetMacAddr(os_gmac_ptr->gmac.config.base_addr, mac_addr); + /* set MAC hardware address */ - netif->hwaddr[0] = p_ctrl->config.macAddr[0]; - netif->hwaddr[1] = p_ctrl->config.macAddr[1]; - netif->hwaddr[2] = p_ctrl->config.macAddr[2]; - netif->hwaddr[3] = p_ctrl->config.macAddr[3]; - netif->hwaddr[4] = p_ctrl->config.macAddr[4]; - netif->hwaddr[5] = p_ctrl->config.macAddr[5]; + netif->hwaddr[0] = mac_addr[0]; + netif->hwaddr[1] = mac_addr[1]; + netif->hwaddr[2] = mac_addr[2]; + netif->hwaddr[3] = mac_addr[3]; + netif->hwaddr[4] = mac_addr[4]; + netif->hwaddr[5] = mac_addr[5]; /* maximum transfer unit */ netif->mtu = GMAC_MTU; @@ -284,22 +265,22 @@ static void low_level_init(struct netif *netif) os_gmac_ptr, os_gmac_ptr->config.mac_input_thread.priority, &os_gmac_ptr->config.mac_input_thread.thread_handle) != pdPASS) { - ETHNETIF_DEBUG_I("xTaskCreate is Error %s\r\n", os_gmac_ptr->config.mac_input_thread.thread_name); - FT_ASSERTVOIDALWAYS(); + ETHNETIF_DEBUG_I("xTaskCreate is Error %s\r\n", os_gmac_ptr->config.mac_input_thread.thread_name); + FT_ASSERTVOIDALWAYS(); } /* Enable MAC and DMA transmission and reception */ FtOsGmacStart(os_gmac_ptr); /* Read Register Configuration */ - GmacPhyReadReg(p_ctrl, PHY_INTERRUPT_ENABLE_OFFSET, ®_value); + FGmacReadPhyReg(&phy, PHY_INTERRUPT_ENABLE_OFFSET, ®_value); reg_value |= (PHY_INTERRUPT_ENABLE_LINK_FAIL); /* Enable Interrupt on change of link status */ - GmacPhyWriteReg(p_ctrl, PHY_INTERRUPT_ENABLE_OFFSET, reg_value); + FGmacWritePhyReg(&phy, PHY_INTERRUPT_ENABLE_OFFSET, reg_value); /* Read Register Configuration */ - GmacPhyReadReg(p_ctrl, PHY_INTERRUPT_ENABLE_OFFSET, ®_value); + FGmacReadPhyReg(&phy, PHY_INTERRUPT_ENABLE_OFFSET, ®_value); #endif /* LWIP_ARP || LWIP_ETHERNET */ @@ -334,18 +315,18 @@ static err_t low_level_output(struct netif *netif, struct pbuf *p) err_t errval; struct pbuf *q; u8 *buffer = NULL; - volatile GmacDmaDesc *dma_tx_desc; + volatile FGmacDmaDesc *dma_tx_desc; u32 frame_length = 0; u32 buffer_offset = 0; u32 bytes_left_to_copy = 0; u32 pay_load_offset = 0; - GmacCtrl *gmac; + FGmac *gmac; FtOsGmac *os_gmac; os_gmac = (FtOsGmac *)container_of(netif, FtOsGmac, netif_object); gmac = &os_gmac->gmac; - dma_tx_desc = &gmac->txDesc[gmac->txRing.descBufIdx]; - buffer = (u8 *)(intptr)(dma_tx_desc->buf1Addr); + dma_tx_desc = &gmac->tx_desc[gmac->tx_ring.desc_buf_idx]; + buffer = (u8 *)(intptr)(dma_tx_desc->buf_addr); if (buffer == NULL) { @@ -360,7 +341,7 @@ static err_t low_level_output(struct netif *netif, struct pbuf *p) for (q = p; q != NULL; q = q->next) { /* Is this buffer available? If not, goto error */ - if ((dma_tx_desc->status & GMAC_DMA_TDES0_OWN) != 0) + if ((dma_tx_desc->status & FGMAC_DMA_TDES0_OWN) != 0) { errval = ERR_USE; ETHNETIF_DEBUG_I("error errval = ERR_USE; \r\n"); @@ -377,19 +358,19 @@ static err_t low_level_output(struct netif *netif, struct pbuf *p) { /* Copy data to Tx buffer*/ memcpy((u8 *)((u8 *)buffer + buffer_offset), (u8 *)((u8 *)q->payload + pay_load_offset), (GMAC_MAX_PACKET_SIZE - buffer_offset)); - GMAC_DMA_INC_DESC(gmac->txRing.descBufIdx, gmac->txRing.descMaxNum); + FGMAC_DMA_INC_DESC(gmac->tx_ring.desc_buf_idx, gmac->tx_ring.desc_max_num); /* Point to next descriptor */ - dma_tx_desc = &gmac->txDesc[gmac->txRing.descBufIdx]; + dma_tx_desc = &gmac->tx_desc[gmac->tx_ring.desc_buf_idx]; /* Check if the Bufferis available */ - if ((dma_tx_desc->status & GMAC_DMA_TDES0_OWN) != (u32)0) + if ((dma_tx_desc->status & FGMAC_DMA_TDES0_OWN) != (u32)0) { errval = ERR_USE; ETHNETIF_DEBUG_I("Check if the Bufferis available \r\n"); goto error; } - buffer = (u8 *)(intptr)(dma_tx_desc->buf1Addr); + buffer = (u8 *)(intptr)(dma_tx_desc->buf_addr); bytes_left_to_copy = bytes_left_to_copy - (GMAC_MAX_PACKET_SIZE - buffer_offset); pay_load_offset = pay_load_offset + (GMAC_MAX_PACKET_SIZE - buffer_offset); frame_length = frame_length + (GMAC_MAX_PACKET_SIZE - buffer_offset); @@ -399,24 +380,25 @@ static err_t low_level_output(struct netif *netif, struct pbuf *p) { ETHNETIF_DEBUG_I(" error Buffer is 0 \r\n"); return ERR_VAL; - } + } } /* Copy the remaining bytes */ memcpy((u8 *)((u8 *)buffer + buffer_offset), (u8 *)((u8 *)q->payload + pay_load_offset), bytes_left_to_copy); buffer_offset = buffer_offset + bytes_left_to_copy; frame_length = frame_length + bytes_left_to_copy; - GMAC_DMA_INC_DESC(gmac->txRing.descBufIdx, gmac->txRing.descMaxNum); + FGMAC_DMA_INC_DESC(gmac->tx_ring.desc_buf_idx, gmac->tx_ring.desc_max_num); } #if ETH_PAD_SIZE pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */ #endif - GmacDmaTransFrame(gmac, frame_length); + FGmacSendFrame(gmac, frame_length); error: - GmacDmaResumeUnderflow(gmac); + FGmacResmuDmaUnderflow(gmac->config.base_addr); + return errval; } @@ -437,27 +419,27 @@ static struct pbuf *low_level_input(struct netif *netif) struct pbuf *q = NULL; u16 length = 0; u8 *buffer; - volatile GmacDmaDesc *dma_rx_desc; + volatile FGmacDmaDesc *dma_rx_desc; u32 buffer_offset = 0; u32 pay_load_offset = 0; u32 bytes_left_to_copy = 0; u32 desc_buffer_index; /* For Current Desc buffer buf position */ FtOsGmac *os_gmac; - GmacCtrl *gmac; + FGmac *gmac; os_gmac = (FtOsGmac *)container_of(netif, FtOsGmac, netif_object); gmac = &os_gmac->gmac; /* get received frame */ - if (GmacRingGetReceivedFrameIT(gmac) != FT_SUCCESS) + if (FGmacRecvFrame(gmac) != FT_SUCCESS) { return NULL; } - desc_buffer_index = gmac->rxRing.descBufIdx; - length = (gmac->rxDesc[desc_buffer_index].status & GMAC_DMA_RDES0_FRAME_LEN_MASK) >> GMAC_DMA_RDES0_FRAME_LEN_SHIFT; - buffer = (u8 *)(intptr)(gmac->rxDesc[desc_buffer_index].buf1Addr); + desc_buffer_index = gmac->rx_ring.desc_buf_idx; + length = (gmac->rx_desc[desc_buffer_index].status & FGMAC_DMA_RDES0_FRAME_LEN_MASK) >> FGMAC_DMA_RDES0_FRAME_LEN_SHIFT; + buffer = (u8 *)(intptr)(gmac->rx_desc[desc_buffer_index].buf_addr); #if ETH_PAD_SIZE @@ -479,7 +461,7 @@ static struct pbuf *low_level_input(struct netif *netif) #if ETH_PAD_SIZE pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */ #endif - dma_rx_desc = &gmac->rxDesc[desc_buffer_index]; + dma_rx_desc = &gmac->rx_desc[desc_buffer_index]; buffer_offset = 0; for (q = p; q != NULL; q = q->next) { @@ -492,14 +474,14 @@ static struct pbuf *low_level_input(struct netif *netif) memcpy((u8 *)((u8 *)q->payload + pay_load_offset), (u8 *)((u8 *)buffer + buffer_offset), (GMAC_MAX_PACKET_SIZE - buffer_offset)); /* Point to next descriptor */ - GMAC_DMA_INC_DESC(desc_buffer_index, gmac->rxRing.descMaxNum); - if (desc_buffer_index == gmac->rxRing.descIdx) + FGMAC_DMA_INC_DESC(desc_buffer_index, gmac->rx_ring.desc_max_num); + if (desc_buffer_index == gmac->rx_ring.desc_idx) { break; } - dma_rx_desc = &gmac->rxDesc[desc_buffer_index]; - buffer = (u8 *)(intptr)(dma_rx_desc->buf1Addr); + dma_rx_desc = &gmac->rx_desc[desc_buffer_index]; + buffer = (u8 *)(intptr)(dma_rx_desc->buf_addr); bytes_left_to_copy = bytes_left_to_copy - (GMAC_MAX_PACKET_SIZE - buffer_offset); pay_load_offset = pay_load_offset + (GMAC_MAX_PACKET_SIZE - buffer_offset); @@ -520,19 +502,18 @@ static struct pbuf *low_level_input(struct netif *netif) /* Release descriptors to DMA */ /* Point to first descriptor */ - dma_rx_desc = &gmac->rxDesc[desc_buffer_index]; + dma_rx_desc = &gmac->rx_desc[desc_buffer_index]; /* Set Own bit in Rx descriptors: gives the buffers back to DMA */ - for (desc_buffer_index = gmac->rxRing.descBufIdx; desc_buffer_index != gmac->rxRing.descIdx; GMAC_DMA_INC_DESC(desc_buffer_index, gmac->rxRing.descMaxNum)) + for (desc_buffer_index = gmac->rx_ring.desc_buf_idx; desc_buffer_index != gmac->rx_ring.desc_idx; FGMAC_DMA_INC_DESC(desc_buffer_index, gmac->rx_ring.desc_max_num)) { - dma_rx_desc->status |= GMAC_DMA_RDES0_OWN; - dma_rx_desc = &gmac->rxDesc[desc_buffer_index]; + dma_rx_desc->status |= FGMAC_DMA_RDES0_OWN; + dma_rx_desc = &gmac->rx_desc[desc_buffer_index]; } /* Sync index */ - gmac->rxRing.descBufIdx = gmac->rxRing.descIdx; - - GmacDmaResumeRecv(gmac); + gmac->rx_ring.desc_buf_idx = gmac->rx_ring.desc_idx; + FGmacResumeDmaRecv(gmac->config.base_addr); return p; } @@ -557,6 +538,7 @@ void ethernetif_input(void const *argument) if (xSemaphoreTake(os_gmac_ptr->s_semaphore, TIME_WAITING_FOR_INPUT) == pdTRUE) { + do { LOCK_TCPIP_CORE(); diff --git a/third-party/lwip-2.1.2/ports/f_gmac/ft_os_gmac.c b/third-party/lwip-2.1.2/ports/f_gmac/ft_os_gmac.c index 5842cc9f..fd5a34d0 100644 --- a/third-party/lwip-2.1.2/ports/f_gmac/ft_os_gmac.c +++ b/third-party/lwip-2.1.2/ports/f_gmac/ft_os_gmac.c @@ -20,7 +20,7 @@ #include #include "ft_os_gmac.h" -#include "gmac.h" +#include "fgmac.h" #include "ft_assert.h" #include "ft_io.h" #include "ft_assert.h" @@ -29,6 +29,7 @@ #include "list.h" #include "ft_debug.h" + #define OS_MAC_DEBUG_TAG "OS_MAC" #define OS_MAC_DEBUG_I(format, ...) FT_DEBUG_PRINT_I(OS_MAC_DEBUG_TAG, format, ##__VA_ARGS__) @@ -37,6 +38,189 @@ #define FT_OS_GMACOBJECT_READLY 0x58 +static boolean rx_data_flag = FALSE; + +static void EthLinkPhyStatusChecker(void *param) +{ + FT_ASSERTVOID(param != NULL); + FGmac *instance_p = (FGmac *)param; + uintptr base_addr = instance_p->config.base_addr; + + u32 phy_status = FGMAC_READ_REG32(base_addr, FGMAC_MAC_PHY_STATUS); + + if (FGMAC_RGSMIIIS_LNKSTS_UP == (FGMAC_RGSMIIIS_LNKSTS & phy_status)) + { + OS_MAC_DEBUG_I("link is up"); + } + else + { + OS_MAC_DEBUG_I("link is down"); + } + + return; +} + +static void EthLinkDmaErrChecker(void *param) +{ + FT_ASSERTVOID(param != NULL); + FGmac *instance_p = (FGmac *)param; + uintptr base_addr = instance_p->config.base_addr; + + u32 reg_val = FGMAC_READ_REG32(base_addr, FGMAC_DMA_INTR_OFFSET); + u32 status = FGMAC_READ_REG32(base_addr, FGMAC_DMA_STATUS_OFFSET); + + if ((FGMAC_DMA_STATUS_TPS & status) && (FGMAC_DMA_INTR_ENA_TSE & reg_val)) + { + OS_MAC_DEBUG_E("Transmit process stopped"); + } + + if ((FGMAC_DMA_STATUS_TU & status) && (FGMAC_DMA_INTR_ENA_TUE & reg_val)) + { + OS_MAC_DEBUG_E("Transmit Buffer Unavailable"); + } + + if ((FGMAC_DMA_STATUS_TJT & status) && (FGMAC_DMA_INTR_ENA_THE & reg_val)) + { + OS_MAC_DEBUG_E("Transmit Jabber Timeout"); + } + + if ((FGMAC_DMA_STATUS_OVF & status) && (FGMAC_DMA_INTR_ENA_OVE & reg_val)) + { + OS_MAC_DEBUG_E("Receive Overflow"); + } + + if ((FGMAC_DMA_STATUS_UNF & status) && (FGMAC_DMA_INTR_ENA_UNE & reg_val)) + { + OS_MAC_DEBUG_E("Transmit Underflow"); + } + + if ((FGMAC_DMA_STATUS_RU & status) && (FGMAC_DMA_INTR_ENA_RUE & reg_val)) + { + OS_MAC_DEBUG_E("Receive Buffer Unavailable"); + } + + if ((FGMAC_DMA_STATUS_RPS & status) && (FGMAC_DMA_INTR_ENA_RSE & reg_val)) + { + OS_MAC_DEBUG_E("Receive Process Stopped"); + } + + if ((FGMAC_DMA_STATUS_RWT & status) && (FGMAC_DMA_INTR_ENA_RWE & reg_val)) + { + OS_MAC_DEBUG_E("Receive Watchdog Timeout"); + } + + if ((FGMAC_DMA_STATUS_ETI & status) && (FGMAC_DMA_INTR_ENA_ETE & reg_val)) + { + OS_MAC_DEBUG_E("Early Transmit Interrupt"); + } + + if ((FGMAC_DMA_STATUS_FBI & status) && (FGMAC_DMA_INTR_ENA_FBE & reg_val)) + { + OS_MAC_DEBUG_E("Fatal Bus Error"); + } + + return; +} + +void EthLinkStatusChecker(void *param) +{ + FT_ASSERTVOID(param); + FGmac *instance_p = (FGmac *)param; + uintptr base_addr = instance_p->config.base_addr; + u32 status = FGMAC_READ_REG32(base_addr, FGMAC_MAC_PHY_STATUS); + u32 speed_status, duplex_status; + u32 speed, duplex; + + /* Check the link status */ + if (FGMAC_RGSMIIIS_LNKSTS_UP == (FGMAC_RGSMIIIS_LNKSTS & status)) + { + speed_status = FGMAC_RGSMIIIS_SPEED & status; + duplex_status = FGMAC_RGSMIIIS_LNKMODE & status; + + if (FGMAC_RGSMIIIS_SPEED_125MHZ == speed_status) + speed = FGMAC_PHY_SPEED_1000; + else if (FGMAC_RGSMIIIS_SPEED_25MHZ == speed_status) + speed = FGMAC_PHY_SPEED_100; + else + speed = FGMAC_PHY_SPEED_10; + + if (FGMAC_RGSMIIIS_LNKMODE_HALF == duplex_status) + duplex = FGMAC_PHY_MODE_HALFDUPLEX; + else + duplex = FGMAC_PHY_MODE_FULLDUPLEX; + + OS_MAC_DEBUG_I("link is up --- %d/%s", + speed, (FGMAC_PHY_MODE_FULLDUPLEX == duplex) ? "full" : "half"); + } + else + { + OS_MAC_DEBUG_I("link is down"); + } + + (void)speed; + (void)duplex; +} + +static void EthLinkRecvDoneCallback(void *param) +{ + FT_ASSERTVOID(param); + FGmac *instance_p = (FGmac *)param; + + if (TRUE == rx_data_flag) + { + OS_MAC_DEBUG_W("last rx data has not been handled !!!"); + } + + rx_data_flag = TRUE; + OS_MAC_DEBUG_I("recv data"); + return; +} + +static void EthLinkTransDoneCallback(void *param) +{ + FT_ASSERTVOID(param); + FGmac *instance_p = (FGmac *)param; + + FGmacResumeDmaSend(instance_p->config.base_addr); + OS_MAC_DEBUG_I("resume trans"); + return; +} + +int FtOsGmacSetupInterrupt(FGmac *instance_p) +{ + LWIP_ASSERT("instance_p != NULL", (instance_p != NULL)); + FGmacConfig *config_p = &instance_p->config; + uintptr base_addr = config_p->base_addr; + u32 irq_num = config_p->irq_num; + u32 irq_priority = (0x8 << 4) + 4 * 16; + + /* disable all gmac & dma intr */ + FGmacSetInterruptMask(instance_p, FGMAC_CTRL_INTR, FGMAC_ISR_MASK_ALL_BITS, FALSE); + FGmacSetInterruptMask(instance_p, FGMAC_DMA_INTR, FGMAC_DMA_INTR_ENA_ALL_MASK, FALSE); + + InterruptSetPriority(irq_num, irq_priority); + InterruptInstall(irq_num, FGmacInterruptHandler, instance_p, "GMAC-IRQ"); + + /* register intr callback */ + FGmacRegisterEvtHandler(instance_p, FGMAC_PHY_STATUS_EVT, EthLinkPhyStatusChecker); + FGmacRegisterEvtHandler(instance_p, FGMAC_DMA_ERR_EVT, EthLinkDmaErrChecker); + FGmacRegisterEvtHandler(instance_p, FGMAC_LINK_STATUS_EVT, EthLinkStatusChecker); + // FGmacRegisterEvtHandler(instance_p, FGMAC_RX_COMPLETE_EVT, EthLinkRecvDoneCallback); + FGmacRegisterEvtHandler(instance_p, FGMAC_TX_COMPLETE_EVT, EthLinkTransDoneCallback); + + /* umask intr */ + InterruptUmask(irq_num); + + /* enable some interrupts */ + FGmacSetInterruptMask(instance_p, FGMAC_CTRL_INTR, FGMAC_ISR_MASK_RSIM, TRUE); + FGmacSetInterruptMask(instance_p, FGMAC_DMA_INTR, FGMAC_DMA_INTR_ENA_NIE | FGMAC_DMA_INTR_ENA_RIE\ + /*FGMAC_DMA_INTR_ENA_ALL_MASK*/, TRUE); + + OS_MAC_DEBUG_I("gmac setup done"); + return 0; +} + + /** * @name: Ft_Os_GmacMem_Create * @msg: Initialize the Gmac TX/Rx Describe Memory 。 @@ -46,8 +230,8 @@ static u8 rx_buf[GMAC_RX_DESCNUM * GMAC_MAX_PACKET_SIZE] __attribute__((aligned(32))); static u8 tx_buf[GMAC_TX_DESCNUM * GMAC_MAX_PACKET_SIZE] __attribute__((aligned(32))); -static u8 tx_desc[GMAC_TX_DESCNUM * sizeof(GmacDmaDesc)] __attribute__((aligned(128))); -static u8 rx_desc[GMAC_RX_DESCNUM * sizeof(GmacDmaDesc) + 128] __attribute__((aligned(128))); +static u8 tx_desc[GMAC_TX_DESCNUM * sizeof(FGmacDmaDesc)] __attribute__((aligned(128))); +static u8 rx_desc[GMAC_RX_DESCNUM * sizeof(FGmacDmaDesc) + 128] __attribute__((aligned(128))); static void FtOsGmacMemCreate(FtOsGmac *os_gmac) { @@ -65,24 +249,24 @@ static void FtOsGmacMemCreate(FtOsGmac *os_gmac) FT_ASSERTVOIDALWAYS(); } - os_gmac->gmac.txDesc = (GmacDmaDesc *)tx_desc; - if (os_gmac->gmac.txDesc == NULL) + os_gmac->gmac.tx_desc = (FGmacDmaDesc *)tx_desc; + if (os_gmac->gmac.tx_desc == NULL) { - OS_MAC_DEBUG_E("txDesc Malloc is error "); + OS_MAC_DEBUG_E("tx_desc Malloc is error "); FT_ASSERTVOIDALWAYS(); } - os_gmac->gmac.rxDesc = (GmacDmaDesc *)rx_desc; - if (os_gmac->gmac.rxDesc == NULL) + os_gmac->gmac.rx_desc = (FGmacDmaDesc *)rx_desc; + if (os_gmac->gmac.rx_desc == NULL) { - OS_MAC_DEBUG_E("rxDesc Malloc is error "); + OS_MAC_DEBUG_E("rx_desc Malloc is error "); FT_ASSERTVOIDALWAYS(); } #define ROUND_UP(x, align) (((long)(x) + ((long)align - 1)) & \ ~((long)align - 1)) - os_gmac->gmac.rxDesc = (GmacDmaDesc *)ROUND_UP(os_gmac->gmac.rxDesc, 128); + os_gmac->gmac.rx_desc = (FGmacDmaDesc *)ROUND_UP(os_gmac->gmac.rx_desc, 128); } static void FtOsGmacMemFree(FtOsGmac *os_gmac) @@ -97,14 +281,14 @@ static void FtOsGmacMemFree(FtOsGmac *os_gmac) vPortFree(os_gmac->tx_buffer); } - if (os_gmac->gmac.rxDesc) + if (os_gmac->gmac.rx_desc) { - vPortFree((void *)(os_gmac->gmac.rxDesc)); + vPortFree((void *)(os_gmac->gmac.rx_desc)); } - if (os_gmac->gmac.txDesc) + if (os_gmac->gmac.tx_desc) { - vPortFree((void *)(os_gmac->gmac.txDesc)); + vPortFree((void *)(os_gmac->gmac.tx_desc)); } } @@ -131,9 +315,10 @@ void FtOsGmacObjectInit(FtOsGmac *os_gmac, FtOsGmacConfig *config) * @param {u32} InstanceId * @return {*} */ -void FtOsGmacInit(FtOsGmac *os_gmac) + +void FtOsGmacInit(FtOsGmac *os_gmac, FGmacPhy *phy_p) { - GmacCtrl *gmac; + FGmac *gmac; FT_ASSERTVOID(os_gmac != NULL); @@ -141,9 +326,16 @@ void FtOsGmacInit(FtOsGmac *os_gmac) gmac = &os_gmac->gmac; FtOsGmacMemFree(os_gmac); - FT_ASSERTVOID(GmacCfgInitialize(gmac, GmacLookupConfig(os_gmac->config.gmac_instance)) == FT_SUCCESS); + + FT_ASSERTVOID(FGmacCfgInitialize(gmac, FGmacLookupConfig(GMAC_INSTANCE_0)) == FT_SUCCESS); + FtOsGmacMemCreate(os_gmac); + /* initialize phy */ + memset(phy_p, 0U, sizeof(FGmacPhy)); + FGmacPhyLookupConfig(GMAC_INSTANCE_0, phy_p); + FT_ASSERTVOID(FGmacPhyCfgInitialize(phy_p) == FT_SUCCESS); + /* Create a binary semaphore used for informing ethernetif of frame reception */ FT_ASSERTVOID((os_gmac->s_semaphore = xSemaphoreCreateBinary()) != NULL); /* Create a event group used for ethernetif of status change */ @@ -156,15 +348,16 @@ void FtOsGmacInit(FtOsGmac *os_gmac) * @param {Ft_Os_Gmac} *Os_Gmac * @return {*} */ + void FtOsGmacStart(FtOsGmac *os_gmac) { - GmacCtrl *gmac; + FGmac *gmac; + FT_ASSERTVOID(os_gmac != NULL); FT_ASSERTVOID((os_gmac->is_ready == FT_OS_GMACOBJECT_READLY)); gmac = &os_gmac->gmac; - u32 ret; + u32 ret = FT_SUCCESS; - ret = GmacHwInitialize(gmac); if (FT_SUCCESS != ret) { OS_MAC_DEBUG_E("gmac return err code %d\r\n", ret); @@ -172,22 +365,23 @@ void FtOsGmacStart(FtOsGmac *os_gmac) } /* Initialize Rx Description list : ring Mode */ - GmacDmaInitRxDescRing(gmac, (GmacDmaDesc *)(gmac->rxDesc), os_gmac->rx_buffer, GMAC_MAX_PACKET_SIZE, GMAC_RX_DESCNUM); + FGmacSetupRxDescRing(gmac, (FGmacDmaDesc *)(gmac->rx_desc), os_gmac->rx_buffer, GMAC_MAX_PACKET_SIZE, GMAC_RX_DESCNUM); /* Initialize Tx Description list : ring Mode */ - GmacDmaInitTxDescRing(gmac, (GmacDmaDesc *)(gmac->txDesc), os_gmac->tx_buffer, GMAC_MAX_PACKET_SIZE, GMAC_TX_DESCNUM); + FGmacSetupTxDescRing(gmac, (FGmacDmaDesc *)(gmac->tx_desc), os_gmac->tx_buffer, GMAC_MAX_PACKET_SIZE, GMAC_TX_DESCNUM); - GmacDmaStart(gmac); + /* enable gmac */ + FGmacStartTrans(gmac); /* Gmac interrupt init */ - GmacIntrInit(gmac); + FtOsGmacSetupInterrupt(gmac); return; } void FtOsGmacStop(FtOsGmac *os_gmac) { - GmacCtrl *gmac; + FGmac *gmac; FT_ASSERTVOID(os_gmac != NULL); FT_ASSERTVOID((os_gmac->is_ready == FT_OS_GMACOBJECT_READLY)); diff --git a/third-party/lwip-2.1.2/ports/f_gmac/ft_os_gmac.h b/third-party/lwip-2.1.2/ports/f_gmac/ft_os_gmac.h index 0143f1f2..aade7877 100644 --- a/third-party/lwip-2.1.2/ports/f_gmac/ft_os_gmac.h +++ b/third-party/lwip-2.1.2/ports/f_gmac/ft_os_gmac.h @@ -19,7 +19,9 @@ #include #include -#include "gmac.h" +#include "fgmac.h" +#include "fgmac_hw.h" +#include "fgmac_phy.h" #include "parameters.h" #include "lwip/netif.h" @@ -36,6 +38,11 @@ #define GMAC_RX_DESCNUM 1024U #define GMAC_TX_DESCNUM 1024U +#define GMAC_MTU 1500U + +/* Common PHY Registers (AR8035) */ +#define PHY_INTERRUPT_ENABLE_OFFSET ((u16)0x12) +#define PHY_INTERRUPT_ENABLE_LINK_FAIL 0x00000800U /* Link fail interrupt, 0 Interrupt disable , 1 Interrupt enable */ struct Ipv4Address { @@ -63,7 +70,7 @@ typedef struct typedef struct { - GmacCtrl gmac; + FGmac gmac; struct netif netif_object; FtOsGmacConfig config; u8 *rx_buffer; /* Buffer for RxDesc */ @@ -73,9 +80,9 @@ typedef struct EventGroupHandle_t s_status_event; /* Event Group to show netif's status ,follow FT_NETIF_XX*/ } FtOsGmac; void FtOsGmacObjectInit(FtOsGmac *os_gmac, FtOsGmacConfig *config); -void FtOsGmacInit(FtOsGmac *os_gmac); +void FtOsGmacInit(FtOsGmac *os_gmac, FGmacPhy *phy_p); void FtOsGmacStart(FtOsGmac *os_gmac); void FtOsGmacStop(FtOsGmac *os_gmac); - +int FtOsGmacSetupInterrupt(FGmac *instance_p); #endif // ! FT_OS_GMAC_H diff --git a/third-party/third-party.mk b/third-party/third-party.mk index 0f6ea5e2..e7bb1837 100644 --- a/third-party/third-party.mk +++ b/third-party/third-party.mk @@ -37,7 +37,7 @@ INC_DIR += $(THIRD_PARTY_CUR_DIR)/lwip-2.1.2/include \ $(THIRD_PARTY_CUR_DIR)/lwip-2.1.2/include/netif # src code of ports -ifdef CONFIG_ENABLE_F_GMAC +ifdef CONFIG_ENABLE_FGMAC INC_DIR += $(THIRD_PARTY_CUR_DIR)/lwip-2.1.2/ports/f_gmac \ $(THIRD_PARTY_CUR_DIR)/lwip-2.1.2/ports/f_gmac/arch -- Gitee From ece34e52e3a60f770e6f94376a36b67ed778b5d1 Mon Sep 17 00:00:00 2001 From: wxd <15576600345@qq.com> Date: Thu, 23 Dec 2021 14:57:25 +0800 Subject: [PATCH 06/14] ft2004 test ok --- configs/d2000_aarch32_defconfig | 2 +- configs/d2000_aarch64_defconfig | 2 +- configs/ft2004_aarch32_defconfig | 2 +- example/freertos_test/README.md | 37 ++++- .../configs/ft2004_aarch32_eg_configs | 135 ++++++++++++++++ .../configs/ft2004_aarch64_eg_configs | 129 +++++++++++++++ example/freertos_test/main.c | 6 +- example/freertos_test/sdkconfig | 26 ++-- example/freertos_test/sdkconfig.h | 25 ++- .../configs/ft2004_aarch32_eg_configs | 4 +- .../configs/ft2004_aarch64_eg_configs | 4 +- example/function_test/sdkconfig | 4 +- example/function_test/sdkconfig.h | 4 +- .../configs/ft2004_aarch32_eg_configs | 138 ++++++++++++++++ .../configs/ft2004_aarch64_eg_configs | 132 ++++++++++++++++ example/hello_world/sdkconfig | 52 +++---- example/hello_world/sdkconfig.h | 49 +++--- example/lwip_test/README.md | 36 ++++- .../configs/ft2004_aarch32_eg_configs | 142 +++++++++++++++++ .../configs/ft2004_aarch64_eg_configs | 136 ++++++++++++++++ example/start_up/sdkconfig | 56 ++++--- example/start_up/sdkconfig.h | 53 +++---- example/start_up/test_uart.c | 12 +- .../configs/ft2004_aarch32_eg_configs | 138 ++++++++++++++++ .../configs/ft2004_aarch64_eg_configs | 132 ++++++++++++++++ example/template/sdkconfig | 48 +++--- example/template/sdkconfig.h | 45 +++--- make/ld_o/Kconfig | 105 ------------- make/ld_o/aarch32_ram.ld | 147 ------------------ make/ld_o/aarch64_ram.ld | 127 --------------- .../freertos/portable/freertos_configs.c | 30 ++-- .../lwip-2.1.2/ports/f_gmac/ethernetif.c | 4 - .../lwip-2.1.2/ports/f_gmac/ft_os_gmac.c | 13 +- 33 files changed, 1349 insertions(+), 626 deletions(-) create mode 100644 example/freertos_test/configs/ft2004_aarch32_eg_configs create mode 100644 example/freertos_test/configs/ft2004_aarch64_eg_configs create mode 100644 example/hello_world/configs/ft2004_aarch32_eg_configs create mode 100644 example/hello_world/configs/ft2004_aarch64_eg_configs create mode 100644 example/start_up/configs/ft2004_aarch32_eg_configs create mode 100644 example/start_up/configs/ft2004_aarch64_eg_configs create mode 100644 example/template/configs/ft2004_aarch32_eg_configs create mode 100644 example/template/configs/ft2004_aarch64_eg_configs delete mode 100644 make/ld_o/Kconfig delete mode 100644 make/ld_o/aarch32_ram.ld delete mode 100644 make/ld_o/aarch64_ram.ld diff --git a/configs/d2000_aarch32_defconfig b/configs/d2000_aarch32_defconfig index 9ade1d8c..7f4b05c1 100644 --- a/configs/d2000_aarch32_defconfig +++ b/configs/d2000_aarch32_defconfig @@ -109,7 +109,7 @@ CONFIG_ROM_SIZE_MB=1 CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 -CONFIG_HEAP_SIZE=0x100000 +CONFIG_HEAP_SIZE=1 CONFIG_STACK_SIZE=0x100000 # end of GNU Linker Setting # end of Building Option diff --git a/configs/d2000_aarch64_defconfig b/configs/d2000_aarch64_defconfig index e048ca5d..bf3905c7 100644 --- a/configs/d2000_aarch64_defconfig +++ b/configs/d2000_aarch64_defconfig @@ -107,7 +107,7 @@ CONFIG_ROM_SIZE_MB=1 CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 -CONFIG_HEAP_SIZE=0x100000 +CONFIG_HEAP_SIZE=1 CONFIG_STACK_TOP_ADDR=0x82000000 # end of Linker Options # end of Building Option diff --git a/configs/ft2004_aarch32_defconfig b/configs/ft2004_aarch32_defconfig index 0e523ebe..ab1cdaab 100644 --- a/configs/ft2004_aarch32_defconfig +++ b/configs/ft2004_aarch32_defconfig @@ -109,7 +109,7 @@ CONFIG_ROM_SIZE_MB=1 CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 -CONFIG_HEAP_SIZE=0x100000 +CONFIG_HEAP_SIZE=1 CONFIG_STACK_SIZE=0x100000 # end of GNU Linker Setting # end of Building Option diff --git a/example/freertos_test/README.md b/example/freertos_test/README.md index 557c184e..59086c1d 100644 --- a/example/freertos_test/README.md +++ b/example/freertos_test/README.md @@ -70,20 +70,47 @@ PRIORITY_TEST----任务优先级测试 THREAD_LOCAL_TEST----线程局部存储thread local storage测试 TIMER_TEST----定时器测试 ``` + +本例子已经提供好具体的编译指令,以下进行介绍: +- make 将目录下的工程进行编译 +- make clean 将目录下的工程进行清理 +- make boot 将目录下的工程进行编译,并将生成的elf 复制到目标地址 +- make load_d2000_aarch64 将预设64bit d2000 下的配置加载至工程中 +- make load_d2000_aarch32 将预设32bit d2000 下的配置加载至工程中 +- make load_ft2004_aarch64 将预设64bit ft2004 下的配置加载至工程中 +- make load_ft2004_aarch32 将预设32bit ft2004 下的配置加载至工程中 +- make menuconfig 配置目录下的参数变量 +- make backup_kconfig 将目录下的sdkconfig 备份到./configs下 + +具体使用方法为: +- 在当前目录下 +- 执行以上指令 + ### 2.3 构建和下载 #### 2.3.1 构建过程 - 在host侧完成配置 ->配置成D2000,对于其它平台,使用对于的默认配置,如FT2000-4 `make config_ft2004_configs` +>配置成ft2004,对于其它平台,使用对于的默认配置,如D2000 `make load_d2000_aarch32` + +- 选择目标平台 +``` +make load_ft2004_aarch32 +``` + +- 选择例程需要的配置 +``` +make menuconfig +``` + +- 进行编译 ``` -$ make config_d2000_configs -$ make menuconfig +make ``` -- 在host侧完成构建 +- 将编译出的镜像放置到tftp目录下 ``` -$ make +make boot ``` #### 2.3.2 下载过程 diff --git a/example/freertos_test/configs/ft2004_aarch32_eg_configs b/example/freertos_test/configs/ft2004_aarch32_eg_configs new file mode 100644 index 00000000..0f8e8d96 --- /dev/null +++ b/example/freertos_test/configs/ft2004_aarch32_eg_configs @@ -0,0 +1,135 @@ + +# +# Project Configuration +# +CONFIG_TARGET_NAME="ft2004_freertos" +CONFIG_LWIP_POLL_TEST=y +# CONFIG_LWIP_INTRRUPT_TEST is not set +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +CONFIG_TARGET_ARMV8_AARCH32=y +# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arch Configuration + +# +# Board Configuration +# +CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_E2000 is not set +# CONFIG_TARGET_D2000 is not set +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +# CONFIG_USE_SERIAL is not set +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +CONFIG_USE_WDT=y + +# +# FWDT Configuration +# +CONFIG_ENABLE_FWDT=y +# end of FWDT Configuration + +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +CONFIG_AARCH32_RAM_LD=y +# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/freertos_test/configs/ft2004_aarch64_eg_configs b/example/freertos_test/configs/ft2004_aarch64_eg_configs new file mode 100644 index 00000000..0ff4d4c3 --- /dev/null +++ b/example/freertos_test/configs/ft2004_aarch64_eg_configs @@ -0,0 +1,129 @@ + +# +# Project Configuration +# +CONFIG_TARGET_NAME="ft2004_freertos" +CONFIG_LWIP_POLL_TEST=y +# CONFIG_LWIP_INTRRUPT_TEST is not set +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +# end of Arch Configuration + +# +# Board Configuration +# +CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_E2000 is not set +# CONFIG_TARGET_D2000 is not set +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +# CONFIG_USE_SERIAL is not set +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +CONFIG_USE_WDT=y + +# +# FWDT Configuration +# +CONFIG_ENABLE_FWDT=y +# end of FWDT Configuration + +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/freertos_test/main.c b/example/freertos_test/main.c index fcde60fd..69c2be12 100644 --- a/example/freertos_test/main.c +++ b/example/freertos_test/main.c @@ -18,9 +18,7 @@ #include "task.h" #include "unity.h" -// #define EVENT_GROUPS_TEST 1 -// #define TRACE_FACILITY_TEST 1 -#if 1 + #define ISR_FLOAT_TEST 1 #define BACKPORT_TEST 1 #define DEBUG_QUEUE_REGISTER_TEST 1 @@ -41,7 +39,7 @@ #define PRIORITY_TEST 1 #define THREAD_LOCAL_TEST 1 #define TIMER_TEST 1 -#endif + #if ISR_FLOAT_TEST extern BaseType_t TestFloatIsrEntry(void); diff --git a/example/freertos_test/sdkconfig b/example/freertos_test/sdkconfig index 6210f59a..0ff4d4c3 100644 --- a/example/freertos_test/sdkconfig +++ b/example/freertos_test/sdkconfig @@ -2,7 +2,7 @@ # # Project Configuration # -CONFIG_TARGET_NAME="d2000_freertos" +CONFIG_TARGET_NAME="ft2004_freertos" CONFIG_LWIP_POLL_TEST=y # CONFIG_LWIP_INTRRUPT_TEST is not set # end of Project Configuration @@ -27,9 +27,9 @@ CONFIG_USE_SYS_TICK=y # # Board Configuration # -# CONFIG_TARGET_F2000_4 is not set +CONFIG_TARGET_F2000_4=y # CONFIG_TARGET_E2000 is not set -CONFIG_TARGET_D2000=y +# CONFIG_TARGET_D2000 is not set # end of Board Configuration # @@ -38,7 +38,7 @@ CONFIG_TARGET_D2000=y # CONFIG_USE_SPI is not set # CONFIG_USE_QSPI is not set CONFIG_USE_GIC=y -CONFIG_EBABLE_GICV3=y +CONFIG_ENABLE_GICV3=y # CONFIG_USE_SERIAL is not set # CONFIG_USE_GPIO is not set # CONFIG_USE_IOMUX is not set @@ -47,15 +47,10 @@ CONFIG_USE_ETH=y # # Eth Configuration # -# CONFIG_ENABLE_F_XMAC is not set +# CONFIG_ENABLE_FXMAC is not set CONFIG_ENABLE_FGMAC=y - -# -# F_GMAC Configuration -# -CONFIG_F_GMAC_PHY_COMMON=y -# CONFIG_F_GMAC_PHY_AR803X is not set -# end of F_GMAC Configuration +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set # end of Eth Configuration # CONFIG_USE_CAN is not set @@ -73,6 +68,7 @@ CONFIG_ENABLE_FWDT=y # CONFIG_USE_DMA is not set # CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set # end of Components Configuration CONFIG_USE_G_LIBC=y @@ -87,6 +83,7 @@ CONFIG_USE_G_LIBC=y # Cross-Compiler Setting # CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 # CONFIG_USE_EXT_COMPILER is not set # end of Cross-Compiler Setting @@ -102,7 +99,6 @@ CONFIG_LOG_INFO=y # # CONFIG_AARCH32_RAM_LD is not set CONFIG_AARCH64_RAM_LD=y -# CONFIG_QEMU_AARCH32_RAM_LD is not set # CONFIG_USER_DEFINED_LD is not set CONFIG_LINK_SCRIPT_ROM=y CONFIG_ROM_START_UP_ADDR=0x80100000 @@ -110,8 +106,8 @@ CONFIG_ROM_SIZE_MB=1 CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 -CONFIG_HEAP_SIZE=0x100000 -CONFIG_STACK_TOP_ADDR=0x82000000 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 # end of Linker Options # end of Building Option diff --git a/example/freertos_test/sdkconfig.h b/example/freertos_test/sdkconfig.h index d9f2ab5f..89f02b81 100644 --- a/example/freertos_test/sdkconfig.h +++ b/example/freertos_test/sdkconfig.h @@ -3,7 +3,7 @@ /* Project Configuration */ -#define CONFIG_TARGET_NAME "d2000_freertos" +#define CONFIG_TARGET_NAME "ft2004_freertos" #define CONFIG_LWIP_POLL_TEST /* CONFIG_LWIP_INTRRUPT_TEST is not set */ /* end of Project Configuration */ @@ -25,9 +25,9 @@ /* Board Configuration */ -/* CONFIG_TARGET_F2000_4 is not set */ +#define CONFIG_TARGET_F2000_4 /* CONFIG_TARGET_E2000 is not set */ -#define CONFIG_TARGET_D2000 +/* CONFIG_TARGET_D2000 is not set */ /* end of Board Configuration */ /* Components Configuration */ @@ -35,7 +35,7 @@ /* CONFIG_USE_SPI is not set */ /* CONFIG_USE_QSPI is not set */ #define CONFIG_USE_GIC -#define CONFIG_EBABLE_GICV3 +#define CONFIG_ENABLE_GICV3 /* CONFIG_USE_SERIAL is not set */ /* CONFIG_USE_GPIO is not set */ /* CONFIG_USE_IOMUX is not set */ @@ -43,14 +43,10 @@ /* Eth Configuration */ -/* CONFIG_ENABLE_F_XMAC is not set */ +/* CONFIG_ENABLE_FXMAC is not set */ #define CONFIG_ENABLE_FGMAC - -/* F_GMAC Configuration */ - -#define CONFIG_F_GMAC_PHY_COMMON -/* CONFIG_F_GMAC_PHY_AR803X is not set */ -/* end of F_GMAC Configuration */ +#define CONFIG_FGMAC_PHY_COMMON +/* CONFIG_FGMAC_PHY_AR803X is not set */ /* end of Eth Configuration */ /* CONFIG_USE_CAN is not set */ /* CONFIG_USE_I2C is not set */ @@ -65,6 +61,7 @@ /* end of FWDT Configuration */ /* CONFIG_USE_DMA is not set */ /* CONFIG_USE_NAND is not set */ +/* CONFIG_USE_RTC is not set */ /* end of Components Configuration */ #define CONFIG_USE_G_LIBC /* CONFIG_USE_NEW_LIBC is not set */ @@ -75,6 +72,7 @@ /* Cross-Compiler Setting */ #define CONFIG_COMPILER_NO_STD_STARUP +#define CONFIG_GCC_OPTIMIZE_LEVEL 0 /* CONFIG_USE_EXT_COMPILER is not set */ /* end of Cross-Compiler Setting */ /* CONFIG_LOG_VERBOS is not set */ @@ -88,7 +86,6 @@ /* CONFIG_AARCH32_RAM_LD is not set */ #define CONFIG_AARCH64_RAM_LD -/* CONFIG_QEMU_AARCH32_RAM_LD is not set */ /* CONFIG_USER_DEFINED_LD is not set */ #define CONFIG_LINK_SCRIPT_ROM #define CONFIG_ROM_START_UP_ADDR 0x80100000 @@ -96,8 +93,8 @@ #define CONFIG_LINK_SCRIPT_RAM #define CONFIG_RAM_START_UP_ADDR 0x81000000 #define CONFIG_RAM_SIZE_MB 64 -#define CONFIG_HEAP_SIZE 0x100000 -#define CONFIG_STACK_TOP_ADDR 0x82000000 +#define CONFIG_HEAP_SIZE 1 +#define CONFIG_STACK_SIZE 0x400 /* end of Linker Options */ /* end of Building Option */ diff --git a/example/function_test/configs/ft2004_aarch32_eg_configs b/example/function_test/configs/ft2004_aarch32_eg_configs index 6b27537c..dcc38b23 100644 --- a/example/function_test/configs/ft2004_aarch32_eg_configs +++ b/example/function_test/configs/ft2004_aarch32_eg_configs @@ -54,7 +54,9 @@ CONFIG_USE_ETH=y # Eth Configuration # # CONFIG_ENABLE_FXMAC is not set -# CONFIG_ENABLE_FGMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set # end of Eth Configuration # CONFIG_USE_CAN is not set diff --git a/example/function_test/configs/ft2004_aarch64_eg_configs b/example/function_test/configs/ft2004_aarch64_eg_configs index 8c69a958..eaa277e2 100644 --- a/example/function_test/configs/ft2004_aarch64_eg_configs +++ b/example/function_test/configs/ft2004_aarch64_eg_configs @@ -53,7 +53,9 @@ CONFIG_USE_ETH=y # Eth Configuration # # CONFIG_ENABLE_FXMAC is not set -# CONFIG_ENABLE_FGMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set # end of Eth Configuration # CONFIG_USE_CAN is not set diff --git a/example/function_test/sdkconfig b/example/function_test/sdkconfig index 8c69a958..eaa277e2 100644 --- a/example/function_test/sdkconfig +++ b/example/function_test/sdkconfig @@ -53,7 +53,9 @@ CONFIG_USE_ETH=y # Eth Configuration # # CONFIG_ENABLE_FXMAC is not set -# CONFIG_ENABLE_FGMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set # end of Eth Configuration # CONFIG_USE_CAN is not set diff --git a/example/function_test/sdkconfig.h b/example/function_test/sdkconfig.h index d3949427..5effd201 100644 --- a/example/function_test/sdkconfig.h +++ b/example/function_test/sdkconfig.h @@ -47,7 +47,9 @@ /* Eth Configuration */ /* CONFIG_ENABLE_FXMAC is not set */ -/* CONFIG_ENABLE_FGMAC is not set */ +#define CONFIG_ENABLE_FGMAC +#define CONFIG_FGMAC_PHY_COMMON +/* CONFIG_FGMAC_PHY_AR803X is not set */ /* end of Eth Configuration */ /* CONFIG_USE_CAN is not set */ /* CONFIG_USE_I2C is not set */ diff --git a/example/hello_world/configs/ft2004_aarch32_eg_configs b/example/hello_world/configs/ft2004_aarch32_eg_configs new file mode 100644 index 00000000..e66146c7 --- /dev/null +++ b/example/hello_world/configs/ft2004_aarch32_eg_configs @@ -0,0 +1,138 @@ + +# +# Project Configuration +# + +# +# FT2000-4 AARCH32 FreeRTOS Configuration +# +CONFIG_TARGET_NAME="ft2004_freertos" +# end of FT2000-4 AARCH32 FreeRTOS Configuration +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +CONFIG_TARGET_ARMV8_AARCH32=y +# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arch Configuration + +# +# Board Configuration +# +CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_E2000 is not set +# CONFIG_TARGET_D2000 is not set +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +CONFIG_AARCH32_RAM_LD=y +# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/hello_world/configs/ft2004_aarch64_eg_configs b/example/hello_world/configs/ft2004_aarch64_eg_configs new file mode 100644 index 00000000..2ef9b357 --- /dev/null +++ b/example/hello_world/configs/ft2004_aarch64_eg_configs @@ -0,0 +1,132 @@ + +# +# Project Configuration +# + +# +# FT2000-4 AARCH32 FreeRTOS Configuration +# +CONFIG_TARGET_NAME="ft2004_freertos" +# end of FT2000-4 AARCH32 FreeRTOS Configuration +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +# end of Arch Configuration + +# +# Board Configuration +# +CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_E2000 is not set +# CONFIG_TARGET_D2000 is not set +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/hello_world/sdkconfig b/example/hello_world/sdkconfig index b8736200..2ef9b357 100644 --- a/example/hello_world/sdkconfig +++ b/example/hello_world/sdkconfig @@ -2,9 +2,12 @@ # # Project Configuration # + +# +# FT2000-4 AARCH32 FreeRTOS Configuration +# CONFIG_TARGET_NAME="ft2004_freertos" -#CONFIG_LWIP_POLL_TEST=y -# CONFIG_LWIP_INTRRUPT_TEST is not set +# end of FT2000-4 AARCH32 FreeRTOS Configuration # end of Project Configuration # @@ -15,14 +18,13 @@ CONFIG_USE_FREERTOS=y # # Arch Configuration # -CONFIG_TARGET_ARMV8_AARCH32=y -# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y # CONFIG_TARGET_ARMV7 is not set CONFIG_USE_CACHE=y CONFIG_USE_L3CACHE=y CONFIG_USE_MMU=y CONFIG_USE_SYS_TICK=y -CONFIG_USE_AARCH64_L1_TO_AARCH32=y # end of Arch Configuration # @@ -39,7 +41,7 @@ CONFIG_TARGET_F2000_4=y # CONFIG_USE_SPI is not set # CONFIG_USE_QSPI is not set CONFIG_USE_GIC=y -CONFIG_EBABLE_GICV3=y +CONFIG_ENABLE_GICV3=y CONFIG_USE_SERIAL=y # @@ -55,15 +57,10 @@ CONFIG_USE_ETH=y # # Eth Configuration # -# CONFIG_ENABLE_F_XMAC is not set +# CONFIG_ENABLE_FXMAC is not set CONFIG_ENABLE_FGMAC=y - -# -# F_GMAC Configuration -# -# CONFIG_F_GMAC_PHY_COMMON is not set -CONFIG_F_GMAC_PHY_AR803X=y -# end of F_GMAC Configuration +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set # end of Eth Configuration # CONFIG_USE_CAN is not set @@ -73,20 +70,23 @@ CONFIG_F_GMAC_PHY_AR803X=y # CONFIG_USE_PCIE is not set # CONFIG_USE_WDT is not set # CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set # end of Components Configuration -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set # end of Standalone Setting # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y # # Cross-Compiler Setting # CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 # CONFIG_USE_EXT_COMPILER is not set # end of Cross-Compiler Setting @@ -98,10 +98,10 @@ CONFIG_LOG_INFO=y # CONFIG_LOG_NONE is not set # -# GNU Linker Setting +# Linker Options # -CONFIG_AARCH32_RAM_LD=y -# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y # CONFIG_USER_DEFINED_LD is not set CONFIG_LINK_SCRIPT_ROM=y CONFIG_ROM_START_UP_ADDR=0x80100000 @@ -109,9 +109,9 @@ CONFIG_ROM_SIZE_MB=1 CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 -CONFIG_HEAP_SIZE=0x100000 -CONFIG_STACK_SIZE=0x100000 -# end of GNU Linker Setting +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 +# end of Linker Options # end of Building Option # @@ -128,11 +128,5 @@ CONFIG_FREERTOS_USE_UART=y # # FreeRTOS Setting # -#CONFIG_USE_LWIP=y - -# -# LWIP Configuration -# -#CONFIG_LWIP_F_GMAC=y -# end of LWIP Configuration +# CONFIG_USE_LWIP is not set # end of FreeRTOS Setting diff --git a/example/hello_world/sdkconfig.h b/example/hello_world/sdkconfig.h index c3d96bf2..d3d3f34f 100644 --- a/example/hello_world/sdkconfig.h +++ b/example/hello_world/sdkconfig.h @@ -3,9 +3,10 @@ /* Project Configuration */ +/* FT2000-4 AARCH32 FreeRTOS Configuration */ + #define CONFIG_TARGET_NAME "ft2004_freertos" -/*CONFIG_LWIP_POLL_TEST=y */ -/* CONFIG_LWIP_INTRRUPT_TEST is not set */ +/* end of FT2000-4 AARCH32 FreeRTOS Configuration */ /* end of Project Configuration */ /* Standalone Setting */ @@ -14,14 +15,13 @@ /* Arch Configuration */ -#define CONFIG_TARGET_ARMV8_AARCH32 -/* CONFIG_TARGET_ARMV8_AARCH64 is not set */ +/* CONFIG_TARGET_ARMV8_AARCH32 is not set */ +#define CONFIG_TARGET_ARMV8_AARCH64 /* CONFIG_TARGET_ARMV7 is not set */ #define CONFIG_USE_CACHE #define CONFIG_USE_L3CACHE #define CONFIG_USE_MMU #define CONFIG_USE_SYS_TICK -#define CONFIG_USE_AARCH64_L1_TO_AARCH32 /* end of Arch Configuration */ /* Board Configuration */ @@ -36,7 +36,7 @@ /* CONFIG_USE_SPI is not set */ /* CONFIG_USE_QSPI is not set */ #define CONFIG_USE_GIC -#define CONFIG_EBABLE_GICV3 +#define CONFIG_ENABLE_GICV3 #define CONFIG_USE_SERIAL /* Usart Configuration */ @@ -49,14 +49,10 @@ /* Eth Configuration */ -/* CONFIG_ENABLE_F_XMAC is not set */ +/* CONFIG_ENABLE_FXMAC is not set */ #define CONFIG_ENABLE_FGMAC - -/* F_GMAC Configuration */ - -/* CONFIG_F_GMAC_PHY_COMMON is not set */ -#define CONFIG_F_GMAC_PHY_AR803X -/* end of F_GMAC Configuration */ +#define CONFIG_FGMAC_PHY_COMMON +/* CONFIG_FGMAC_PHY_AR803X is not set */ /* end of Eth Configuration */ /* CONFIG_USE_CAN is not set */ /* CONFIG_USE_I2C is not set */ @@ -65,17 +61,19 @@ /* CONFIG_USE_PCIE is not set */ /* CONFIG_USE_WDT is not set */ /* CONFIG_USE_DMA is not set */ +/* CONFIG_USE_NAND is not set */ +/* CONFIG_USE_RTC is not set */ /* end of Components Configuration */ -#define CONFIG_USE_LIBC +#define CONFIG_USE_G_LIBC +/* CONFIG_USE_NEW_LIBC is not set */ /* end of Standalone Setting */ /* Building Option */ -#define CONFIG_ENVI_UBUNTU_20_04 - /* Cross-Compiler Setting */ #define CONFIG_COMPILER_NO_STD_STARUP +#define CONFIG_GCC_OPTIMIZE_LEVEL 0 /* CONFIG_USE_EXT_COMPILER is not set */ /* end of Cross-Compiler Setting */ /* CONFIG_LOG_VERBOS is not set */ @@ -85,10 +83,10 @@ /* CONFIG_LOG_ERROR is not set */ /* CONFIG_LOG_NONE is not set */ -/* GNU Linker Setting */ +/* Linker Options */ -#define CONFIG_AARCH32_RAM_LD -/* CONFIG_AARCH64_RAM_LD is not set */ +/* CONFIG_AARCH32_RAM_LD is not set */ +#define CONFIG_AARCH64_RAM_LD /* CONFIG_USER_DEFINED_LD is not set */ #define CONFIG_LINK_SCRIPT_ROM #define CONFIG_ROM_START_UP_ADDR 0x80100000 @@ -96,9 +94,9 @@ #define CONFIG_LINK_SCRIPT_RAM #define CONFIG_RAM_START_UP_ADDR 0x81000000 #define CONFIG_RAM_SIZE_MB 64 -#define CONFIG_HEAP_SIZE 0x100000 -#define CONFIG_STACK_SIZE 0x100000 -/* end of GNU Linker Setting */ +#define CONFIG_HEAP_SIZE 1 +#define CONFIG_STACK_SIZE 0x400 +/* end of Linker Options */ /* end of Building Option */ /* Component Configuration */ @@ -111,12 +109,7 @@ /* FreeRTOS Setting */ -/*CONFIG_USE_LWIP=y */ - -/* LWIP Configuration */ - -/*CONFIG_LWIP_F_GMAC=y */ -/* end of LWIP Configuration */ +/* CONFIG_USE_LWIP is not set */ /* end of FreeRTOS Setting */ #endif diff --git a/example/lwip_test/README.md b/example/lwip_test/README.md index 745924a9..8705d69b 100644 --- a/example/lwip_test/README.md +++ b/example/lwip_test/README.md @@ -46,20 +46,46 @@ - Use LWIP +本例子已经提供好具体的编译指令,以下进行介绍: +- make 将目录下的工程进行编译 +- make clean 将目录下的工程进行清理 +- make boot 将目录下的工程进行编译,并将生成的elf 复制到目标地址 +- make load_d2000_aarch64 将预设64bit d2000 下的配置加载至工程中 +- make load_d2000_aarch32 将预设32bit d2000 下的配置加载至工程中 +- make load_ft2004_aarch64 将预设64bit ft2004 下的配置加载至工程中 +- make load_ft2004_aarch32 将预设32bit ft2004 下的配置加载至工程中 +- make menuconfig 配置目录下的参数变量 +- make backup_kconfig 将目录下的sdkconfig 备份到./configs下 + +具体使用方法为: +- 在当前目录下 +- 执行以上指令 + ### 2.3 构建和下载 #### 2.3.1 构建过程 - 在host侧完成配置 ->配置成D2000,对于其它平台,使用对于的默认配置,如FT2000-4 `make config_ft2004_configs` +>配置成ft2004,对于其它平台,使用对于的默认配置,如D2000 `make load_d2000_aarch32` + +- 选择目标平台 +``` +make load_ft2004_aarch32 +``` + +- 选择例程需要的配置 +``` +make menuconfig +``` + +- 进行编译 ``` -$ make config_d2000_configs -$ make menuconfig +make ``` -- 在host侧完成构建 +- 将编译出的镜像放置到tftp目录下 ``` -$ make +make boot ``` #### 2.3.2 下载过程 diff --git a/example/start_up/configs/ft2004_aarch32_eg_configs b/example/start_up/configs/ft2004_aarch32_eg_configs new file mode 100644 index 00000000..861b811d --- /dev/null +++ b/example/start_up/configs/ft2004_aarch32_eg_configs @@ -0,0 +1,142 @@ + +# +# Project Configuration +# + +# +# FT2000-4 AARCH32 FreeRTOS Configuration +# +CONFIG_TARGET_NAME="ft2004_freertos" +# CONFIG_DEMO_HELLO_WORLD is not set +# CONFIG_DEMO_GET_CPU_STATS is not set +CONFIG_DEMO_MSG_QUEUE=y +# CONFIG_DEMO_SEMAPHORE is not set +# end of FT2000-4 AARCH32 FreeRTOS Configuration +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +CONFIG_TARGET_ARMV8_AARCH32=y +# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arch Configuration + +# +# Board Configuration +# +CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_E2000 is not set +# CONFIG_TARGET_D2000 is not set +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +CONFIG_AARCH32_RAM_LD=y +# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/start_up/configs/ft2004_aarch64_eg_configs b/example/start_up/configs/ft2004_aarch64_eg_configs new file mode 100644 index 00000000..64b0c443 --- /dev/null +++ b/example/start_up/configs/ft2004_aarch64_eg_configs @@ -0,0 +1,136 @@ + +# +# Project Configuration +# + +# +# FT2000-4 AARCH32 FreeRTOS Configuration +# +CONFIG_TARGET_NAME="ft2004_freertos" +# CONFIG_DEMO_HELLO_WORLD is not set +# CONFIG_DEMO_GET_CPU_STATS is not set +CONFIG_DEMO_MSG_QUEUE=y +# CONFIG_DEMO_SEMAPHORE is not set +# end of FT2000-4 AARCH32 FreeRTOS Configuration +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +# end of Arch Configuration + +# +# Board Configuration +# +CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_E2000 is not set +# CONFIG_TARGET_D2000 is not set +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/start_up/sdkconfig b/example/start_up/sdkconfig index b8736200..64b0c443 100644 --- a/example/start_up/sdkconfig +++ b/example/start_up/sdkconfig @@ -2,9 +2,16 @@ # # Project Configuration # + +# +# FT2000-4 AARCH32 FreeRTOS Configuration +# CONFIG_TARGET_NAME="ft2004_freertos" -#CONFIG_LWIP_POLL_TEST=y -# CONFIG_LWIP_INTRRUPT_TEST is not set +# CONFIG_DEMO_HELLO_WORLD is not set +# CONFIG_DEMO_GET_CPU_STATS is not set +CONFIG_DEMO_MSG_QUEUE=y +# CONFIG_DEMO_SEMAPHORE is not set +# end of FT2000-4 AARCH32 FreeRTOS Configuration # end of Project Configuration # @@ -15,14 +22,13 @@ CONFIG_USE_FREERTOS=y # # Arch Configuration # -CONFIG_TARGET_ARMV8_AARCH32=y -# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y # CONFIG_TARGET_ARMV7 is not set CONFIG_USE_CACHE=y CONFIG_USE_L3CACHE=y CONFIG_USE_MMU=y CONFIG_USE_SYS_TICK=y -CONFIG_USE_AARCH64_L1_TO_AARCH32=y # end of Arch Configuration # @@ -39,7 +45,7 @@ CONFIG_TARGET_F2000_4=y # CONFIG_USE_SPI is not set # CONFIG_USE_QSPI is not set CONFIG_USE_GIC=y -CONFIG_EBABLE_GICV3=y +CONFIG_ENABLE_GICV3=y CONFIG_USE_SERIAL=y # @@ -55,15 +61,10 @@ CONFIG_USE_ETH=y # # Eth Configuration # -# CONFIG_ENABLE_F_XMAC is not set +# CONFIG_ENABLE_FXMAC is not set CONFIG_ENABLE_FGMAC=y - -# -# F_GMAC Configuration -# -# CONFIG_F_GMAC_PHY_COMMON is not set -CONFIG_F_GMAC_PHY_AR803X=y -# end of F_GMAC Configuration +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set # end of Eth Configuration # CONFIG_USE_CAN is not set @@ -73,20 +74,23 @@ CONFIG_F_GMAC_PHY_AR803X=y # CONFIG_USE_PCIE is not set # CONFIG_USE_WDT is not set # CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set # end of Components Configuration -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set # end of Standalone Setting # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y # # Cross-Compiler Setting # CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 # CONFIG_USE_EXT_COMPILER is not set # end of Cross-Compiler Setting @@ -98,10 +102,10 @@ CONFIG_LOG_INFO=y # CONFIG_LOG_NONE is not set # -# GNU Linker Setting +# Linker Options # -CONFIG_AARCH32_RAM_LD=y -# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y # CONFIG_USER_DEFINED_LD is not set CONFIG_LINK_SCRIPT_ROM=y CONFIG_ROM_START_UP_ADDR=0x80100000 @@ -109,9 +113,9 @@ CONFIG_ROM_SIZE_MB=1 CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 -CONFIG_HEAP_SIZE=0x100000 -CONFIG_STACK_SIZE=0x100000 -# end of GNU Linker Setting +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 +# end of Linker Options # end of Building Option # @@ -128,11 +132,5 @@ CONFIG_FREERTOS_USE_UART=y # # FreeRTOS Setting # -#CONFIG_USE_LWIP=y - -# -# LWIP Configuration -# -#CONFIG_LWIP_F_GMAC=y -# end of LWIP Configuration +# CONFIG_USE_LWIP is not set # end of FreeRTOS Setting diff --git a/example/start_up/sdkconfig.h b/example/start_up/sdkconfig.h index c3d96bf2..c699e58b 100644 --- a/example/start_up/sdkconfig.h +++ b/example/start_up/sdkconfig.h @@ -3,9 +3,14 @@ /* Project Configuration */ +/* FT2000-4 AARCH32 FreeRTOS Configuration */ + #define CONFIG_TARGET_NAME "ft2004_freertos" -/*CONFIG_LWIP_POLL_TEST=y */ -/* CONFIG_LWIP_INTRRUPT_TEST is not set */ +/* CONFIG_DEMO_HELLO_WORLD is not set */ +/* CONFIG_DEMO_GET_CPU_STATS is not set */ +#define CONFIG_DEMO_MSG_QUEUE +/* CONFIG_DEMO_SEMAPHORE is not set */ +/* end of FT2000-4 AARCH32 FreeRTOS Configuration */ /* end of Project Configuration */ /* Standalone Setting */ @@ -14,14 +19,13 @@ /* Arch Configuration */ -#define CONFIG_TARGET_ARMV8_AARCH32 -/* CONFIG_TARGET_ARMV8_AARCH64 is not set */ +/* CONFIG_TARGET_ARMV8_AARCH32 is not set */ +#define CONFIG_TARGET_ARMV8_AARCH64 /* CONFIG_TARGET_ARMV7 is not set */ #define CONFIG_USE_CACHE #define CONFIG_USE_L3CACHE #define CONFIG_USE_MMU #define CONFIG_USE_SYS_TICK -#define CONFIG_USE_AARCH64_L1_TO_AARCH32 /* end of Arch Configuration */ /* Board Configuration */ @@ -36,7 +40,7 @@ /* CONFIG_USE_SPI is not set */ /* CONFIG_USE_QSPI is not set */ #define CONFIG_USE_GIC -#define CONFIG_EBABLE_GICV3 +#define CONFIG_ENABLE_GICV3 #define CONFIG_USE_SERIAL /* Usart Configuration */ @@ -49,14 +53,10 @@ /* Eth Configuration */ -/* CONFIG_ENABLE_F_XMAC is not set */ +/* CONFIG_ENABLE_FXMAC is not set */ #define CONFIG_ENABLE_FGMAC - -/* F_GMAC Configuration */ - -/* CONFIG_F_GMAC_PHY_COMMON is not set */ -#define CONFIG_F_GMAC_PHY_AR803X -/* end of F_GMAC Configuration */ +#define CONFIG_FGMAC_PHY_COMMON +/* CONFIG_FGMAC_PHY_AR803X is not set */ /* end of Eth Configuration */ /* CONFIG_USE_CAN is not set */ /* CONFIG_USE_I2C is not set */ @@ -65,17 +65,19 @@ /* CONFIG_USE_PCIE is not set */ /* CONFIG_USE_WDT is not set */ /* CONFIG_USE_DMA is not set */ +/* CONFIG_USE_NAND is not set */ +/* CONFIG_USE_RTC is not set */ /* end of Components Configuration */ -#define CONFIG_USE_LIBC +#define CONFIG_USE_G_LIBC +/* CONFIG_USE_NEW_LIBC is not set */ /* end of Standalone Setting */ /* Building Option */ -#define CONFIG_ENVI_UBUNTU_20_04 - /* Cross-Compiler Setting */ #define CONFIG_COMPILER_NO_STD_STARUP +#define CONFIG_GCC_OPTIMIZE_LEVEL 0 /* CONFIG_USE_EXT_COMPILER is not set */ /* end of Cross-Compiler Setting */ /* CONFIG_LOG_VERBOS is not set */ @@ -85,10 +87,10 @@ /* CONFIG_LOG_ERROR is not set */ /* CONFIG_LOG_NONE is not set */ -/* GNU Linker Setting */ +/* Linker Options */ -#define CONFIG_AARCH32_RAM_LD -/* CONFIG_AARCH64_RAM_LD is not set */ +/* CONFIG_AARCH32_RAM_LD is not set */ +#define CONFIG_AARCH64_RAM_LD /* CONFIG_USER_DEFINED_LD is not set */ #define CONFIG_LINK_SCRIPT_ROM #define CONFIG_ROM_START_UP_ADDR 0x80100000 @@ -96,9 +98,9 @@ #define CONFIG_LINK_SCRIPT_RAM #define CONFIG_RAM_START_UP_ADDR 0x81000000 #define CONFIG_RAM_SIZE_MB 64 -#define CONFIG_HEAP_SIZE 0x100000 -#define CONFIG_STACK_SIZE 0x100000 -/* end of GNU Linker Setting */ +#define CONFIG_HEAP_SIZE 1 +#define CONFIG_STACK_SIZE 0x400 +/* end of Linker Options */ /* end of Building Option */ /* Component Configuration */ @@ -111,12 +113,7 @@ /* FreeRTOS Setting */ -/*CONFIG_USE_LWIP=y */ - -/* LWIP Configuration */ - -/*CONFIG_LWIP_F_GMAC=y */ -/* end of LWIP Configuration */ +/* CONFIG_USE_LWIP is not set */ /* end of FreeRTOS Setting */ #endif diff --git a/example/start_up/test_uart.c b/example/start_up/test_uart.c index 4091994d..735a6af6 100644 --- a/example/start_up/test_uart.c +++ b/example/start_up/test_uart.c @@ -13,21 +13,21 @@ */ #include #include "ft_types.h" -#include "pl011_uart.h" +#include "fpl011.h" #include "gicv3.h" #include "interrupt.h" -static Pl011 pl011_obj; +static FPl011 pl011_obj; void Uart1Init(void) { - Pl011Config config = *Pl011LookupConfig(1); + FPl011Config config = *FPl011LookupConfig(1); printf("config addr: 0x%x \r\n", config.base_address); - Pl011CfgInitialize(&pl011_obj, &config); - Pl011SetOptions(&pl011_obj, FUART_OPTION_UARTEN | FUART_OPTION_RXEN | FUART_OPTION_TXEN | FUART_OPTION_FIFOEN); + FPl011CfgInitialize(&pl011_obj, &config); + FPl011SetOptions(&pl011_obj, FPL011_OPTION_UARTEN | FPL011_OPTION_RXEN | FPL011_OPTION_TXEN | FPL011_OPTION_FIFOEN); } u8 BlockReceive() { - return Pl011BlockReceive(&pl011_obj); + return FPl011BlockReceive(&pl011_obj); } \ No newline at end of file diff --git a/example/template/configs/ft2004_aarch32_eg_configs b/example/template/configs/ft2004_aarch32_eg_configs new file mode 100644 index 00000000..4f195517 --- /dev/null +++ b/example/template/configs/ft2004_aarch32_eg_configs @@ -0,0 +1,138 @@ + +# +# Project Configuration +# + +# +# Template Configuration +# +CONFIG_TARGET_NAME="ft2004_freertos" +# end of Template Configuration +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +CONFIG_TARGET_ARMV8_AARCH32=y +# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arch Configuration + +# +# Board Configuration +# +CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_E2000 is not set +# CONFIG_TARGET_D2000 is not set +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +CONFIG_AARCH32_RAM_LD=y +# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/template/configs/ft2004_aarch64_eg_configs b/example/template/configs/ft2004_aarch64_eg_configs new file mode 100644 index 00000000..54f116ae --- /dev/null +++ b/example/template/configs/ft2004_aarch64_eg_configs @@ -0,0 +1,132 @@ + +# +# Project Configuration +# + +# +# Template Configuration +# +CONFIG_TARGET_NAME="ft2004_freertos" +# end of Template Configuration +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +# end of Arch Configuration + +# +# Board Configuration +# +CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_E2000 is not set +# CONFIG_TARGET_D2000 is not set +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/template/sdkconfig b/example/template/sdkconfig index b8736200..4f195517 100644 --- a/example/template/sdkconfig +++ b/example/template/sdkconfig @@ -2,9 +2,12 @@ # # Project Configuration # + +# +# Template Configuration +# CONFIG_TARGET_NAME="ft2004_freertos" -#CONFIG_LWIP_POLL_TEST=y -# CONFIG_LWIP_INTRRUPT_TEST is not set +# end of Template Configuration # end of Project Configuration # @@ -39,7 +42,7 @@ CONFIG_TARGET_F2000_4=y # CONFIG_USE_SPI is not set # CONFIG_USE_QSPI is not set CONFIG_USE_GIC=y -CONFIG_EBABLE_GICV3=y +CONFIG_ENABLE_GICV3=y CONFIG_USE_SERIAL=y # @@ -55,15 +58,10 @@ CONFIG_USE_ETH=y # # Eth Configuration # -# CONFIG_ENABLE_F_XMAC is not set +# CONFIG_ENABLE_FXMAC is not set CONFIG_ENABLE_FGMAC=y - -# -# F_GMAC Configuration -# -# CONFIG_F_GMAC_PHY_COMMON is not set -CONFIG_F_GMAC_PHY_AR803X=y -# end of F_GMAC Configuration +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set # end of Eth Configuration # CONFIG_USE_CAN is not set @@ -73,20 +71,23 @@ CONFIG_F_GMAC_PHY_AR803X=y # CONFIG_USE_PCIE is not set # CONFIG_USE_WDT is not set # CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set # end of Components Configuration -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set # end of Standalone Setting # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y # # Cross-Compiler Setting # CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 # CONFIG_USE_EXT_COMPILER is not set # end of Cross-Compiler Setting @@ -98,7 +99,7 @@ CONFIG_LOG_INFO=y # CONFIG_LOG_NONE is not set # -# GNU Linker Setting +# Linker Options # CONFIG_AARCH32_RAM_LD=y # CONFIG_AARCH64_RAM_LD is not set @@ -109,9 +110,14 @@ CONFIG_ROM_SIZE_MB=1 CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 -CONFIG_HEAP_SIZE=0x100000 -CONFIG_STACK_SIZE=0x100000 -# end of GNU Linker Setting +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options # end of Building Option # @@ -128,11 +134,5 @@ CONFIG_FREERTOS_USE_UART=y # # FreeRTOS Setting # -#CONFIG_USE_LWIP=y - -# -# LWIP Configuration -# -#CONFIG_LWIP_F_GMAC=y -# end of LWIP Configuration +# CONFIG_USE_LWIP is not set # end of FreeRTOS Setting diff --git a/example/template/sdkconfig.h b/example/template/sdkconfig.h index c3d96bf2..ac92b721 100644 --- a/example/template/sdkconfig.h +++ b/example/template/sdkconfig.h @@ -3,9 +3,10 @@ /* Project Configuration */ +/* Template Configuration */ + #define CONFIG_TARGET_NAME "ft2004_freertos" -/*CONFIG_LWIP_POLL_TEST=y */ -/* CONFIG_LWIP_INTRRUPT_TEST is not set */ +/* end of Template Configuration */ /* end of Project Configuration */ /* Standalone Setting */ @@ -36,7 +37,7 @@ /* CONFIG_USE_SPI is not set */ /* CONFIG_USE_QSPI is not set */ #define CONFIG_USE_GIC -#define CONFIG_EBABLE_GICV3 +#define CONFIG_ENABLE_GICV3 #define CONFIG_USE_SERIAL /* Usart Configuration */ @@ -49,14 +50,10 @@ /* Eth Configuration */ -/* CONFIG_ENABLE_F_XMAC is not set */ +/* CONFIG_ENABLE_FXMAC is not set */ #define CONFIG_ENABLE_FGMAC - -/* F_GMAC Configuration */ - -/* CONFIG_F_GMAC_PHY_COMMON is not set */ -#define CONFIG_F_GMAC_PHY_AR803X -/* end of F_GMAC Configuration */ +#define CONFIG_FGMAC_PHY_COMMON +/* CONFIG_FGMAC_PHY_AR803X is not set */ /* end of Eth Configuration */ /* CONFIG_USE_CAN is not set */ /* CONFIG_USE_I2C is not set */ @@ -65,17 +62,19 @@ /* CONFIG_USE_PCIE is not set */ /* CONFIG_USE_WDT is not set */ /* CONFIG_USE_DMA is not set */ +/* CONFIG_USE_NAND is not set */ +/* CONFIG_USE_RTC is not set */ /* end of Components Configuration */ -#define CONFIG_USE_LIBC +#define CONFIG_USE_G_LIBC +/* CONFIG_USE_NEW_LIBC is not set */ /* end of Standalone Setting */ /* Building Option */ -#define CONFIG_ENVI_UBUNTU_20_04 - /* Cross-Compiler Setting */ #define CONFIG_COMPILER_NO_STD_STARUP +#define CONFIG_GCC_OPTIMIZE_LEVEL 0 /* CONFIG_USE_EXT_COMPILER is not set */ /* end of Cross-Compiler Setting */ /* CONFIG_LOG_VERBOS is not set */ @@ -85,7 +84,7 @@ /* CONFIG_LOG_ERROR is not set */ /* CONFIG_LOG_NONE is not set */ -/* GNU Linker Setting */ +/* Linker Options */ #define CONFIG_AARCH32_RAM_LD /* CONFIG_AARCH64_RAM_LD is not set */ @@ -96,9 +95,14 @@ #define CONFIG_LINK_SCRIPT_RAM #define CONFIG_RAM_START_UP_ADDR 0x81000000 #define CONFIG_RAM_SIZE_MB 64 -#define CONFIG_HEAP_SIZE 0x100000 -#define CONFIG_STACK_SIZE 0x100000 -/* end of GNU Linker Setting */ +#define CONFIG_HEAP_SIZE 1 +#define CONFIG_SVC_STACK_SIZE 0x1000 +#define CONFIG_SYS_STACK_SIZE 0x1000 +#define CONFIG_IRQ_STACK_SIZE 0x1000 +#define CONFIG_ABORT_STACK_SIZE 0x1000 +#define CONFIG_FIQ_STACK_SIZE 0x1000 +#define CONFIG_UNDEF_STACK_SIZE 0x1000 +/* end of Linker Options */ /* end of Building Option */ /* Component Configuration */ @@ -111,12 +115,7 @@ /* FreeRTOS Setting */ -/*CONFIG_USE_LWIP=y */ - -/* LWIP Configuration */ - -/*CONFIG_LWIP_F_GMAC=y */ -/* end of LWIP Configuration */ +/* CONFIG_USE_LWIP is not set */ /* end of FreeRTOS Setting */ #endif diff --git a/make/ld_o/Kconfig b/make/ld_o/Kconfig deleted file mode 100644 index 46a76361..00000000 --- a/make/ld_o/Kconfig +++ /dev/null @@ -1,105 +0,0 @@ -# entry of menuconfig - -menu "Linker Options" - choice - prompt "Select Linker Script Template" - optional - default QEMU_AARCH32_RAM_LD if TARGET_AARCH32_QEMU - - config AARCH32_RAM_LD - bool "Use aarch32_ram.ld" - help - Use linkscript for booting AARCH32 Baremetal Image from DDR - - config AARCH64_RAM_LD - bool "Use aarch64_ram.ld" - help - Use linkscript for booting AARCH64 Baremetal Image from DDR - - if USE_BAREMETAL_AMP - config AARCH32_AMP_RAM_MASTER_LD - bool "Use aarch32_amp_master_ram.ld" - help - Use linkscript for booting AARCH32 Master Baremetal Image from DDR - - config AARCH32_AMP_RAM_SLAVE_LD - bool "Use aarch32_amp_slave_ram.ld" - help - Use linkscript for booting AARCH32 Slave Baremetal Image from DDR - endif - - config QEMU_AARCH32_RAM_LD - bool "Use qemu_aarch32_ram.ld" - help - Use linkscript booting AARCH32 Qemu from DDR - - config USER_DEFINED_LD - bool "Other link script" - help - Use other link script provided by User - - endchoice - - config LINK_SCRIPT_ROM - bool "Allocate ROM" - default y - help - Allocate ROM for link scripts - - if LINK_SCRIPT_ROM - config ROM_START_UP_ADDR - hex "ROM Start up Address" - default "0x80100000" - help - Assign Start up Address for ROM in Linkscript - - config ROM_SIZE_MB - int "ROM Size (MB)" - default "1" - help - Assign ROM size for Master Core in Linkscript - endif - - config LINK_SCRIPT_RAM - bool "Allocate RAM" - default y - help - Allocate RAM for link scripts - - if LINK_SCRIPT_RAM - config RAM_START_UP_ADDR - hex "RAM Start up Address" - default "0x81000000" - help - Assign Start up Address for RAM in Linkscript - - config RAM_SIZE_MB - int "RAM Size (MB)" - default "64" - help - Assign RAM size in Linkscript - endif - - config HEAP_SIZE - hex "Heap Size" - default "0x100000" - help - Assign Heap size in Linkscript - - if TARGET_ARMV8_AARCH32 - config STACK_SIZE - hex "Stack Size" - default "0x100000" - help - Assign Stack size in Linkscript - endif - - if TARGET_ARMV8_AARCH64 - config STACK_TOP_ADDR - hex "Stack Top Address" - default "0x82000000" - help - Assign Stack top address in Linkscript - endif -endmenu - diff --git a/make/ld_o/aarch32_ram.ld b/make/ld_o/aarch32_ram.ld deleted file mode 100644 index 9d1ff192..00000000 --- a/make/ld_o/aarch32_ram.ld +++ /dev/null @@ -1,147 +0,0 @@ -#include "sdkconfig.h" - -OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") -OUTPUT_ARCH(arm) - -ENTRY(Startup_Aarch32) - - -HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : CONFIG_HEAP_SIZE; - -/* pretend that 0x80100000 is ROM, 0x81000000 is RAM */ -/* because vexpress-qemu is not able to emulate flash memory as ROM */ -/* space is significant to avoid syntax error when linking */ -MEMORY -{ - ROM (rx) : ORIGIN = CONFIG_ROM_START_UP_ADDR, LENGTH = CONFIG_ROM_SIZE_MB * 1M - RAM (rwx): ORIGIN = CONFIG_RAM_START_UP_ADDR, LENGTH = CONFIG_RAM_SIZE_MB * 1M -} - -SECTIONS -{ - .text : { - _text_start = .; - KEEP(*(.Startup_Aarch32)) - *(.vector_table) - *(.text*) - *(.rodata*) /* make life easier without rodata section */ - *(.glue_7) /* glue arm to thumb code */ - *(.glue_7t) /* glue thumb to arm code */ - } > ROM /* .text should linked to ROM */ - . = ALIGN(8); - - /* .ARM.exidx is sorted, so has to go in its own output section. */ - .ARM : - { - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - /* This is used by the startup in order to initialize the .data secion */ - } > ROM - - .rodata : - { - *(.rodata .rodata.* .gnu.linkonce.r.*) - - . = ALIGN(8); - _shell_command_start = .; - KEEP (*(shellCommand)) - _shell_command_end = .; - } > ROM - - .init : - { - KEEP (*(SORT_NONE(.init))) - }> ROM - - .fini : - { - KEEP (*(SORT_NONE(.fini))) - }> ROM - - .eh_frame : - { - KEEP (*(.eh_frame)) - }> ROM - - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - }> ROM - - .ARM.exidx : - { - __exidx_start = .; - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - __exidx_end = .; - }> ROM - - .fini_array : - { - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP (*(SORT(.fini_array.*))) - KEEP (*(.fini_array )) - PROVIDE_HIDDEN (__fini_array_end = .); - }> ROM - - .dtors : - { - KEEP (*crtbegin.o(.dtors)) - KEEP (*crtbegin?.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - . = ALIGN(16); - _rom_end = .; - }> ROM - - - . = ALIGN(4096); /* align to page size */ - _text_end = .; - - /* data segment, contains data that can be modified by the program at run-time, - global and static variables that have a non-zero initial value will normally go here */ - .data : AT(_text_end){ - _data_start = .; /* .data section will be redise at runtime */ - *(.data) - . = ALIGN(4096); /* align to page size */ - _data_end = .; - } > RAM /* link it all to RAM */ - - /* unitialized data segment, variables explicitly initialized with zero to BSS */ - .bss : { - __bss_start__ = .; - _bss_start = __bss_start__; - *(.bss) - __bss_end__ = .; - _bss_end = __bss_end__; - } > RAM - - .heap : - { - . = ALIGN(8); - __end__ = .; - PROVIDE(end = .); - HeapBase = .; - _heap_start = .; - . += HEAP_SIZE; - _heap_end = .; - HeapLimit = .; /* Add for _sbrk */ - } > RAM - - _fiq_stack_start = ADDR(.heap) + SIZEOF(.heap); - _fiq_stack_end = _fiq_stack_start + CONFIG_STACK_SIZE; /* 64 KB */ - - _irq_stack_start = _fiq_stack_end; - _irq_stack_end = _irq_stack_start + CONFIG_STACK_SIZE; /* 64 KB */ - - _sys_stack_start = _irq_stack_end; - _sys_stack_end = _sys_stack_start + CONFIG_STACK_SIZE; /* 64 KB */ - - /* put svc at end and start up with SVC mode */ - _svc_stack_start = _sys_stack_end; - _svc_stack_end = _svc_stack_start + CONFIG_STACK_SIZE; /* 64 KB */ - - _irq_stack_size = _irq_stack_end - _irq_stack_start; - _fiq_stack_size = _fiq_stack_end - _fiq_stack_start; - _sys_stack_size = _sys_stack_end - _sys_stack_start; - _svc_stack_size = _svc_stack_end - _svc_stack_start; -} diff --git a/make/ld_o/aarch64_ram.ld b/make/ld_o/aarch64_ram.ld deleted file mode 100644 index ea919ee5..00000000 --- a/make/ld_o/aarch64_ram.ld +++ /dev/null @@ -1,127 +0,0 @@ -#include "sdkconfig.h" - -ENTRY(_boot) - -MEMORY -{ -#if defined(CONFIG_LINK_SCRIPT_ROM) - ROM (rx) : ORIGIN = CONFIG_ROM_START_UP_ADDR, LENGTH = CONFIG_ROM_SIZE_MB * 1M -#endif -#if defined(CONFIG_LINK_SCRIPT_RAM) - RAM (rwx): ORIGIN = CONFIG_RAM_START_UP_ADDR, LENGTH = CONFIG_RAM_SIZE_MB * 1M -#endif -} - - -SECTIONS -{ - - .text : - { - KEEP(*(.StartUp)) - KEEP(*(.vectors)) - KEEP(*(.text.boot)) - *(.text) - . = ALIGN(8); - }> ROM - - - .rodata : - { - *(.rodata .rodata.* .gnu.linkonce.r.*) - - . = ALIGN(8); - _shell_command_start = .; - KEEP (*(shellCommand)) - _shell_command_end = .; - } > ROM - - .init : - { - KEEP (*(SORT_NONE(.init))) - }> ROM - - .fini : - { - KEEP (*(SORT_NONE(.fini))) - }> ROM - - .eh_frame : - { - KEEP (*(.eh_frame)) - }> ROM - - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - }> ROM - - .ARM.exidx : - { - __exidx_start = .; - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - __exidx_end = .; - }> ROM - - .fini_array : - { - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP (*(SORT(.fini_array.*))) - KEEP (*(.fini_array )) - PROVIDE_HIDDEN (__fini_array_end = .); - }> ROM - - .dtors : - { - KEEP (*crtbegin.o(.dtors)) - KEEP (*crtbegin?.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - . = ALIGN(16); - _rom_end = .; - }> ROM - - .data :AT(ADDR(.dtors) + SIZEOF(.dtors)) - { - __data_start = .; - *(.data) - *(.data .data.* .gnu.linkonce.d.*) - SORT(CONSTRUCTORS) - . = ALIGN(4096); /* align to page size */ - __data_end = .; - }> RAM - - - - .bss : - { - . = ALIGN(8); - __bss_start__ = .; - __bss_start = __bss_start__; - bss = .; - *(.bss) - . = ALIGN(8); - __bss_end__ = .; - __bss_end = __bss_end__; - }> RAM - - .heap (NOLOAD): - { - . = ALIGN(64); - __end__ = .; - PROVIDE(end = .); - HeapBase = .; - _heap_start = .; - . = . + CONFIG_HEAP_SIZE; - _heap_end = .; - HeapLimit = .; - } > RAM - - - . = CONFIG_STACK_TOP_ADDR ; /* stack memory */ - stack_top = .; - - -} -__bss_size = (__bss_end - __bss_start)>>3; \ No newline at end of file diff --git a/third-party/freertos/portable/freertos_configs.c b/third-party/freertos/portable/freertos_configs.c index 2e81801c..c990e564 100644 --- a/third-party/freertos/portable/freertos_configs.c +++ b/third-party/freertos/portable/freertos_configs.c @@ -54,16 +54,16 @@ static u32 cntfrq; /* System frequency */ void vConfigureTickInterrupt(void) { - // Disable the timer + /* Disable the timer */ GenericTimerStop(); - // Get system frequency + /* Get system frequency */ cntfrq = GenericTimerFrequecy(); - // Set tick rate + /* Set tick rate */ GenericTimerCompare(cntfrq / configTICK_RATE_HZ); GenericTimerInterruptEnable(); - // Set as the lowest priority + /* Set as the lowest priority */ InterruptSetPriority(GENERIC_TIMER_NS_IRQ_NUM, configKERNEL_INTERRUPT_PRIORITY); InterruptUmask(GENERIC_TIMER_NS_IRQ_NUM); @@ -86,10 +86,10 @@ static void vFIrqHandler(int ir) isr_func = isr_table[ir].handler; if (isr_func) { - /* Interrupt for myself. */ - param = isr_table[ir].param; - /* turn to interrupt service routine */ - isr_func(ir, param); + /* Interrupt for myself. */ + param = isr_table[ir].param; + /* turn to interrupt service routine */ + isr_func(ir, param); } /* end of interrupt */ InterruptAck(ir); @@ -99,8 +99,6 @@ volatile unsigned int gCpuRuntime; #ifdef __aarch64__ -extern void IRQInterrupt(void *value); - void vApplicationIRQHandler(uint32_t ulICCIAR) { int ulInterruptID; @@ -119,22 +117,18 @@ void vApplicationIRQHandler(uint32_t ulICCIAR) } else { - // printf("IRQInterrupt is exit \r\n") ; - // IRQInterrupt(NULL) ; vFIrqHandler(ulInterruptID); } } #else -extern void IrqInterruptHandler(void) ; - void vApplicationFPUSafeIRQHandler(uint32_t ulICCIAR) { int ulInterruptID; /* Interrupts cannot be re-enabled until the source of the interrupt is - cleared. The ID of the interrupt is obtained by bitwise ANDing the ICCIAR - value with 0x3FF. */ + cleared. The ID of the interrupt is obtained by bitwise ANDing the ICCIAR + value with 0x3FF. */ ulInterruptID = ulICCIAR & 0x3FFUL; /* call handler function */ @@ -145,9 +139,7 @@ void vApplicationFPUSafeIRQHandler(uint32_t ulICCIAR) FreeRTOS_Tick_Handler(); } else - { - // printf("IRQInterrupt is exit ulInterruptID=%d \r\n", ulInterruptID) ; - // IrqInterruptHandler(); + { vFIrqHandler(ulInterruptID); } } diff --git a/third-party/lwip-2.1.2/ports/f_gmac/ethernetif.c b/third-party/lwip-2.1.2/ports/f_gmac/ethernetif.c index 7758fa44..22eeca55 100644 --- a/third-party/lwip-2.1.2/ports/f_gmac/ethernetif.c +++ b/third-party/lwip-2.1.2/ports/f_gmac/ethernetif.c @@ -89,7 +89,6 @@ struct ethernetif { FGmac *ethctrl; }; - static FGmac gctrl; /* huge size ctrl block */ static FGmacPhy phy; @@ -100,8 +99,6 @@ static u8 rx_buf[GMAC_RX_DESCNUM * GMAC_MAX_PACKET_SIZE] __aligned(GMAC_DMA_MIN_ static FGmacDmaDesc tx_desc[GMAC_TX_DESCNUM] __aligned(GMAC_DMA_MIN_ALIGN); static FGmacDmaDesc rx_desc[GMAC_RX_DESCNUM] __aligned(GMAC_DMA_MIN_ALIGN); - - /** * @name: eth_ctrl_init * @msg: config gmac and initialization @@ -118,7 +115,6 @@ u32 eth_ctrl_init(FGmac *pctrl) void ethernet_link_thread(void *argument) { - EventBits_t ev; FtOsGmac *os_gmac_ptr = (FtOsGmac *)argument; struct netif *netif = &os_gmac_ptr->netif_object; diff --git a/third-party/lwip-2.1.2/ports/f_gmac/ft_os_gmac.c b/third-party/lwip-2.1.2/ports/f_gmac/ft_os_gmac.c index fd5a34d0..5aec6de4 100644 --- a/third-party/lwip-2.1.2/ports/f_gmac/ft_os_gmac.c +++ b/third-party/lwip-2.1.2/ports/f_gmac/ft_os_gmac.c @@ -15,7 +15,6 @@ #include #include #include - #include #include @@ -29,7 +28,6 @@ #include "list.h" #include "ft_debug.h" - #define OS_MAC_DEBUG_TAG "OS_MAC" #define OS_MAC_DEBUG_I(format, ...) FT_DEBUG_PRINT_I(OS_MAC_DEBUG_TAG, format, ##__VA_ARGS__) @@ -205,7 +203,6 @@ int FtOsGmacSetupInterrupt(FGmac *instance_p) FGmacRegisterEvtHandler(instance_p, FGMAC_PHY_STATUS_EVT, EthLinkPhyStatusChecker); FGmacRegisterEvtHandler(instance_p, FGMAC_DMA_ERR_EVT, EthLinkDmaErrChecker); FGmacRegisterEvtHandler(instance_p, FGMAC_LINK_STATUS_EVT, EthLinkStatusChecker); - // FGmacRegisterEvtHandler(instance_p, FGMAC_RX_COMPLETE_EVT, EthLinkRecvDoneCallback); FGmacRegisterEvtHandler(instance_p, FGMAC_TX_COMPLETE_EVT, EthLinkTransDoneCallback); /* umask intr */ @@ -235,6 +232,7 @@ static u8 rx_desc[GMAC_RX_DESCNUM * sizeof(FGmacDmaDesc) + 128] __attribute__((a static void FtOsGmacMemCreate(FtOsGmac *os_gmac) { + FT_ASSERTVOID(os_gmac != NULL); os_gmac->rx_buffer = rx_buf; if (os_gmac->rx_buffer == NULL) { @@ -271,6 +269,7 @@ static void FtOsGmacMemCreate(FtOsGmac *os_gmac) static void FtOsGmacMemFree(FtOsGmac *os_gmac) { + FT_ASSERTVOID(os_gmac != NULL); if (os_gmac->rx_buffer) { vPortFree(os_gmac->rx_buffer); @@ -318,12 +317,12 @@ void FtOsGmacObjectInit(FtOsGmac *os_gmac, FtOsGmacConfig *config) void FtOsGmacInit(FtOsGmac *os_gmac, FGmacPhy *phy_p) { - FGmac *gmac; FT_ASSERTVOID(os_gmac != NULL); - + FT_ASSERTVOID(phy_p != NULL); FT_ASSERTVOID((os_gmac->is_ready == FT_OS_GMACOBJECT_READLY)); + FGmac *gmac; gmac = &os_gmac->gmac; FtOsGmacMemFree(os_gmac); @@ -351,10 +350,10 @@ void FtOsGmacInit(FtOsGmac *os_gmac, FGmacPhy *phy_p) void FtOsGmacStart(FtOsGmac *os_gmac) { - FGmac *gmac; - FT_ASSERTVOID(os_gmac != NULL); FT_ASSERTVOID((os_gmac->is_ready == FT_OS_GMACOBJECT_READLY)); + + FGmac *gmac; gmac = &os_gmac->gmac; u32 ret = FT_SUCCESS; -- Gitee From 4cf53fa9f20ac1053b414082c455922adfb4ecc7 Mon Sep 17 00:00:00 2001 From: wxd <15576600345@qq.com> Date: Thu, 23 Dec 2021 15:06:35 +0800 Subject: [PATCH 07/14] ft2004 test ok 1 --- example/function_test/src/test_uart.c_o | 33 ------------------- .../lwip-2.1.2/ports/f_gmac/ethernetif.c | 2 ++ 2 files changed, 2 insertions(+), 33 deletions(-) delete mode 100644 example/function_test/src/test_uart.c_o diff --git a/example/function_test/src/test_uart.c_o b/example/function_test/src/test_uart.c_o deleted file mode 100644 index d85825a7..00000000 --- a/example/function_test/src/test_uart.c_o +++ /dev/null @@ -1,33 +0,0 @@ -/* - * @ : Copyright (c) 2021 Phytium Information Technology, Inc. - * - * SPDX-License-Identifier: Apache-2.0. - * - * @Date: 2021-07-05 13:48:25 - * @LastEditTime: 2021-12-15 15:53:25 - * @Description:  This files is for - * - * @Modify History: - * Ver   Who        Date         Changes - * ----- ------     --------    -------------------------------------- - */ -#include -#include "ft_types.h" -#include "pl011_uart.h" -#include "gicv3.h" -#include "interrupt.h" - -static Pl011 pl011_obj; - -void Uart1Init(void) -{ - Pl011Config config = *Pl011LookupConfig(1); - printf("config addr: 0x%x \r\n", config.base_address); - Pl011CfgInitialize(&pl011_obj, &config); - Pl011SetOptions(&pl011_obj, FUART_OPTION_UARTEN | FUART_OPTION_RXEN | FUART_OPTION_TXEN | FUART_OPTION_FIFOEN); -} - -u8 BlockReceive() -{ - return Pl011BlockReceive(&pl011_obj); -} \ No newline at end of file diff --git a/third-party/lwip-2.1.2/ports/f_gmac/ethernetif.c b/third-party/lwip-2.1.2/ports/f_gmac/ethernetif.c index 22eeca55..f68af0c3 100644 --- a/third-party/lwip-2.1.2/ports/f_gmac/ethernetif.c +++ b/third-party/lwip-2.1.2/ports/f_gmac/ethernetif.c @@ -44,6 +44,8 @@ #include "ft_os_gmac.h" #include "fgmac.h" +#include "fgmac_hw.h" +#include "fgmac_phy.h" #include "ft_assert.h" #include "interrupt.h" -- Gitee From d084637bf97fbf8d0acbfa8fb176dce8fc94a3f9 Mon Sep 17 00:00:00 2001 From: wxd <15576600345@qq.com> Date: Thu, 23 Dec 2021 15:52:05 +0800 Subject: [PATCH 08/14] d2000 test ok --- configs/d2000_aarch32_defconfig | 2 +- configs/d2000_aarch64_defconfig | 2 +- configs/ft2004_aarch32_defconfig | 2 +- configs/ft2004_aarch64_defconfig | 2 +- .../configs/d2000_aarch32_eg_configs | 135 +++++++++++++++++ .../configs/d2000_aarch64_eg_configs | 129 ++++++++++++++++ example/freertos_test/sdkconfig | 8 +- example/freertos_test/sdkconfig.h | 8 +- .../configs/d2000_aarch32_eg_configs | 133 ++++++++++++++++ .../configs/d2000_aarch64_eg_configs | 127 ++++++++++++++++ example/function_test/sdkconfig | 8 +- example/function_test/sdkconfig.h | 8 +- .../configs/d2000_aarch32_eg_configs | 131 ++++++++++++++++ .../configs/d2000_aarch64_eg_configs | 125 +++++++++++++++ example/hello_world/sdkconfig | 17 +-- example/hello_world/sdkconfig.h | 15 +- .../configs/d2000_aarch32_eg_configs | 134 +++++++++++++++++ .../configs/d2000_aarch64_eg_configs | 128 ++++++++++++++++ example/lwip_test/sdkconfig | 19 +-- example/lwip_test/sdkconfig.h | 17 +-- .../start_up/configs/d2000_aarch32_eg_configs | 142 ++++++++++++++++++ .../start_up/configs/d2000_aarch64_eg_configs | 136 +++++++++++++++++ example/start_up/sdkconfig | 8 +- example/start_up/sdkconfig.h | 8 +- .../template/configs/d2000_aarch32_eg_configs | 131 ++++++++++++++++ .../template/configs/d2000_aarch64_eg_configs | 125 +++++++++++++++ example/template/sdkconfig | 33 ++-- example/template/sdkconfig.h | 31 ++-- make/menuconfig.mk | 5 + 29 files changed, 1651 insertions(+), 118 deletions(-) create mode 100644 example/freertos_test/configs/d2000_aarch32_eg_configs create mode 100644 example/freertos_test/configs/d2000_aarch64_eg_configs create mode 100644 example/function_test/configs/d2000_aarch32_eg_configs create mode 100644 example/function_test/configs/d2000_aarch64_eg_configs create mode 100644 example/hello_world/configs/d2000_aarch32_eg_configs create mode 100644 example/hello_world/configs/d2000_aarch64_eg_configs create mode 100644 example/lwip_test/configs/d2000_aarch32_eg_configs create mode 100644 example/lwip_test/configs/d2000_aarch64_eg_configs create mode 100644 example/start_up/configs/d2000_aarch32_eg_configs create mode 100644 example/start_up/configs/d2000_aarch64_eg_configs create mode 100644 example/template/configs/d2000_aarch32_eg_configs create mode 100644 example/template/configs/d2000_aarch64_eg_configs diff --git a/configs/d2000_aarch32_defconfig b/configs/d2000_aarch32_defconfig index 7f4b05c1..b20e08ce 100644 --- a/configs/d2000_aarch32_defconfig +++ b/configs/d2000_aarch32_defconfig @@ -37,7 +37,7 @@ CONFIG_TARGET_D2000=y # CONFIG_USE_SPI is not set # CONFIG_USE_QSPI is not set CONFIG_USE_GIC=y -CONFIG_EBABLE_GICV3=y +CONFIG_ENABLE_GICV3=y # CONFIG_USE_SERIAL is not set # diff --git a/configs/d2000_aarch64_defconfig b/configs/d2000_aarch64_defconfig index bf3905c7..a1bffdcd 100644 --- a/configs/d2000_aarch64_defconfig +++ b/configs/d2000_aarch64_defconfig @@ -38,7 +38,7 @@ CONFIG_TARGET_D2000=y # CONFIG_USE_SPI is not set # CONFIG_USE_QSPI is not set CONFIG_USE_GIC=y -CONFIG_EBABLE_GICV3=y +CONFIG_ENABLE_GICV3=y # CONFIG_USE_SERIAL is not set # diff --git a/configs/ft2004_aarch32_defconfig b/configs/ft2004_aarch32_defconfig index ab1cdaab..ff482858 100644 --- a/configs/ft2004_aarch32_defconfig +++ b/configs/ft2004_aarch32_defconfig @@ -39,7 +39,7 @@ CONFIG_TARGET_F2000_4=y # CONFIG_USE_SPI is not set # CONFIG_USE_QSPI is not set CONFIG_USE_GIC=y -CONFIG_EBABLE_GICV3=y +CONFIG_ENABLE_GICV3=y # CONFIG_USE_SERIAL is not set # diff --git a/configs/ft2004_aarch64_defconfig b/configs/ft2004_aarch64_defconfig index 01f5e62a..9c842ff9 100644 --- a/configs/ft2004_aarch64_defconfig +++ b/configs/ft2004_aarch64_defconfig @@ -37,7 +37,7 @@ CONFIG_TARGET_F2000_4=y # CONFIG_USE_SPI is not set # CONFIG_USE_QSPI is not set CONFIG_USE_GIC=y -CONFIG_EBABLE_GICV3=y +CONFIG_ENABLE_GICV3=y # CONFIG_USE_SERIAL is not set # diff --git a/example/freertos_test/configs/d2000_aarch32_eg_configs b/example/freertos_test/configs/d2000_aarch32_eg_configs new file mode 100644 index 00000000..0dfaa7ac --- /dev/null +++ b/example/freertos_test/configs/d2000_aarch32_eg_configs @@ -0,0 +1,135 @@ + +# +# Project Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +CONFIG_LWIP_POLL_TEST=y +# CONFIG_LWIP_INTRRUPT_TEST is not set +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +CONFIG_TARGET_ARMV8_AARCH32=y +# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +# CONFIG_USE_SYS_TICK is not set +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arch Configuration + +# +# Board Configuration +# +# CONFIG_TARGET_F2000_4 is not set +# CONFIG_TARGET_E2000 is not set +CONFIG_TARGET_D2000=y +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +# CONFIG_USE_SERIAL is not set +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +CONFIG_USE_WDT=y + +# +# FWDT Configuration +# +CONFIG_ENABLE_FWDT=y +# end of FWDT Configuration + +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +CONFIG_AARCH32_RAM_LD=y +# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/freertos_test/configs/d2000_aarch64_eg_configs b/example/freertos_test/configs/d2000_aarch64_eg_configs new file mode 100644 index 00000000..1bf5efe6 --- /dev/null +++ b/example/freertos_test/configs/d2000_aarch64_eg_configs @@ -0,0 +1,129 @@ + +# +# Project Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +CONFIG_LWIP_POLL_TEST=y +# CONFIG_LWIP_INTRRUPT_TEST is not set +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +# CONFIG_USE_SYS_TICK is not set +# end of Arch Configuration + +# +# Board Configuration +# +# CONFIG_TARGET_F2000_4 is not set +# CONFIG_TARGET_E2000 is not set +CONFIG_TARGET_D2000=y +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +# CONFIG_USE_SERIAL is not set +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +CONFIG_USE_WDT=y + +# +# FWDT Configuration +# +CONFIG_ENABLE_FWDT=y +# end of FWDT Configuration + +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/freertos_test/sdkconfig b/example/freertos_test/sdkconfig index 0ff4d4c3..1bf5efe6 100644 --- a/example/freertos_test/sdkconfig +++ b/example/freertos_test/sdkconfig @@ -2,7 +2,7 @@ # # Project Configuration # -CONFIG_TARGET_NAME="ft2004_freertos" +CONFIG_TARGET_NAME="d2000_freertos" CONFIG_LWIP_POLL_TEST=y # CONFIG_LWIP_INTRRUPT_TEST is not set # end of Project Configuration @@ -21,15 +21,15 @@ CONFIG_TARGET_ARMV8_AARCH64=y CONFIG_USE_CACHE=y CONFIG_USE_L3CACHE=y CONFIG_USE_MMU=y -CONFIG_USE_SYS_TICK=y +# CONFIG_USE_SYS_TICK is not set # end of Arch Configuration # # Board Configuration # -CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_F2000_4 is not set # CONFIG_TARGET_E2000 is not set -# CONFIG_TARGET_D2000 is not set +CONFIG_TARGET_D2000=y # end of Board Configuration # diff --git a/example/freertos_test/sdkconfig.h b/example/freertos_test/sdkconfig.h index 89f02b81..0db78ce5 100644 --- a/example/freertos_test/sdkconfig.h +++ b/example/freertos_test/sdkconfig.h @@ -3,7 +3,7 @@ /* Project Configuration */ -#define CONFIG_TARGET_NAME "ft2004_freertos" +#define CONFIG_TARGET_NAME "d2000_freertos" #define CONFIG_LWIP_POLL_TEST /* CONFIG_LWIP_INTRRUPT_TEST is not set */ /* end of Project Configuration */ @@ -20,14 +20,14 @@ #define CONFIG_USE_CACHE #define CONFIG_USE_L3CACHE #define CONFIG_USE_MMU -#define CONFIG_USE_SYS_TICK +/* CONFIG_USE_SYS_TICK is not set */ /* end of Arch Configuration */ /* Board Configuration */ -#define CONFIG_TARGET_F2000_4 +/* CONFIG_TARGET_F2000_4 is not set */ /* CONFIG_TARGET_E2000 is not set */ -/* CONFIG_TARGET_D2000 is not set */ +#define CONFIG_TARGET_D2000 /* end of Board Configuration */ /* Components Configuration */ diff --git a/example/function_test/configs/d2000_aarch32_eg_configs b/example/function_test/configs/d2000_aarch32_eg_configs new file mode 100644 index 00000000..474c4a22 --- /dev/null +++ b/example/function_test/configs/d2000_aarch32_eg_configs @@ -0,0 +1,133 @@ + +# +# Project Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +CONFIG_TARGET_ARMV8_AARCH32=y +# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +# CONFIG_USE_SYS_TICK is not set +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arch Configuration + +# +# Board Configuration +# +# CONFIG_TARGET_F2000_4 is not set +# CONFIG_TARGET_E2000 is not set +CONFIG_TARGET_D2000=y +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +CONFIG_AARCH32_RAM_LD=y +# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/function_test/configs/d2000_aarch64_eg_configs b/example/function_test/configs/d2000_aarch64_eg_configs new file mode 100644 index 00000000..e60f19fe --- /dev/null +++ b/example/function_test/configs/d2000_aarch64_eg_configs @@ -0,0 +1,127 @@ + +# +# Project Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +# CONFIG_USE_SYS_TICK is not set +# end of Arch Configuration + +# +# Board Configuration +# +# CONFIG_TARGET_F2000_4 is not set +# CONFIG_TARGET_E2000 is not set +CONFIG_TARGET_D2000=y +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/function_test/sdkconfig b/example/function_test/sdkconfig index eaa277e2..e60f19fe 100644 --- a/example/function_test/sdkconfig +++ b/example/function_test/sdkconfig @@ -2,7 +2,7 @@ # # Project Configuration # -CONFIG_TARGET_NAME="ft2004_freertos" +CONFIG_TARGET_NAME="d2000_freertos" # end of Project Configuration # @@ -19,15 +19,15 @@ CONFIG_TARGET_ARMV8_AARCH64=y CONFIG_USE_CACHE=y CONFIG_USE_L3CACHE=y CONFIG_USE_MMU=y -CONFIG_USE_SYS_TICK=y +# CONFIG_USE_SYS_TICK is not set # end of Arch Configuration # # Board Configuration # -CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_F2000_4 is not set # CONFIG_TARGET_E2000 is not set -# CONFIG_TARGET_D2000 is not set +CONFIG_TARGET_D2000=y # end of Board Configuration # diff --git a/example/function_test/sdkconfig.h b/example/function_test/sdkconfig.h index 5effd201..b789a4f8 100644 --- a/example/function_test/sdkconfig.h +++ b/example/function_test/sdkconfig.h @@ -3,7 +3,7 @@ /* Project Configuration */ -#define CONFIG_TARGET_NAME "ft2004_freertos" +#define CONFIG_TARGET_NAME "d2000_freertos" /* end of Project Configuration */ /* Standalone Setting */ @@ -18,14 +18,14 @@ #define CONFIG_USE_CACHE #define CONFIG_USE_L3CACHE #define CONFIG_USE_MMU -#define CONFIG_USE_SYS_TICK +/* CONFIG_USE_SYS_TICK is not set */ /* end of Arch Configuration */ /* Board Configuration */ -#define CONFIG_TARGET_F2000_4 +/* CONFIG_TARGET_F2000_4 is not set */ /* CONFIG_TARGET_E2000 is not set */ -/* CONFIG_TARGET_D2000 is not set */ +#define CONFIG_TARGET_D2000 /* end of Board Configuration */ /* Components Configuration */ diff --git a/example/hello_world/configs/d2000_aarch32_eg_configs b/example/hello_world/configs/d2000_aarch32_eg_configs new file mode 100644 index 00000000..e5097300 --- /dev/null +++ b/example/hello_world/configs/d2000_aarch32_eg_configs @@ -0,0 +1,131 @@ + +# +# Project Configuration +# + +# +# FT2000-4 AARCH32 FreeRTOS Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +# end of FT2000-4 AARCH32 FreeRTOS Configuration +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +CONFIG_TARGET_ARMV8_AARCH32=y +# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +# CONFIG_USE_SYS_TICK is not set +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arch Configuration + +# +# Board Configuration +# +# CONFIG_TARGET_F2000_4 is not set +# CONFIG_TARGET_E2000 is not set +CONFIG_TARGET_D2000=y +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +# CONFIG_USE_SERIAL is not set +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +CONFIG_AARCH32_RAM_LD=y +# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/hello_world/configs/d2000_aarch64_eg_configs b/example/hello_world/configs/d2000_aarch64_eg_configs new file mode 100644 index 00000000..8180c819 --- /dev/null +++ b/example/hello_world/configs/d2000_aarch64_eg_configs @@ -0,0 +1,125 @@ + +# +# Project Configuration +# + +# +# FT2000-4 AARCH32 FreeRTOS Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +# end of FT2000-4 AARCH32 FreeRTOS Configuration +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +# CONFIG_USE_SYS_TICK is not set +# end of Arch Configuration + +# +# Board Configuration +# +# CONFIG_TARGET_F2000_4 is not set +# CONFIG_TARGET_E2000 is not set +CONFIG_TARGET_D2000=y +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +# CONFIG_USE_SERIAL is not set +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/hello_world/sdkconfig b/example/hello_world/sdkconfig index 2ef9b357..8180c819 100644 --- a/example/hello_world/sdkconfig +++ b/example/hello_world/sdkconfig @@ -6,7 +6,7 @@ # # FT2000-4 AARCH32 FreeRTOS Configuration # -CONFIG_TARGET_NAME="ft2004_freertos" +CONFIG_TARGET_NAME="d2000_freertos" # end of FT2000-4 AARCH32 FreeRTOS Configuration # end of Project Configuration @@ -24,15 +24,15 @@ CONFIG_TARGET_ARMV8_AARCH64=y CONFIG_USE_CACHE=y CONFIG_USE_L3CACHE=y CONFIG_USE_MMU=y -CONFIG_USE_SYS_TICK=y +# CONFIG_USE_SYS_TICK is not set # end of Arch Configuration # # Board Configuration # -CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_F2000_4 is not set # CONFIG_TARGET_E2000 is not set -# CONFIG_TARGET_D2000 is not set +CONFIG_TARGET_D2000=y # end of Board Configuration # @@ -42,14 +42,7 @@ CONFIG_TARGET_F2000_4=y # CONFIG_USE_QSPI is not set CONFIG_USE_GIC=y CONFIG_ENABLE_GICV3=y -CONFIG_USE_SERIAL=y - -# -# Usart Configuration -# -CONFIG_ENABLE_Pl011_UART=y -# end of Usart Configuration - +# CONFIG_USE_SERIAL is not set # CONFIG_USE_GPIO is not set # CONFIG_USE_IOMUX is not set CONFIG_USE_ETH=y diff --git a/example/hello_world/sdkconfig.h b/example/hello_world/sdkconfig.h index d3d3f34f..42217ca2 100644 --- a/example/hello_world/sdkconfig.h +++ b/example/hello_world/sdkconfig.h @@ -5,7 +5,7 @@ /* FT2000-4 AARCH32 FreeRTOS Configuration */ -#define CONFIG_TARGET_NAME "ft2004_freertos" +#define CONFIG_TARGET_NAME "d2000_freertos" /* end of FT2000-4 AARCH32 FreeRTOS Configuration */ /* end of Project Configuration */ @@ -21,14 +21,14 @@ #define CONFIG_USE_CACHE #define CONFIG_USE_L3CACHE #define CONFIG_USE_MMU -#define CONFIG_USE_SYS_TICK +/* CONFIG_USE_SYS_TICK is not set */ /* end of Arch Configuration */ /* Board Configuration */ -#define CONFIG_TARGET_F2000_4 +/* CONFIG_TARGET_F2000_4 is not set */ /* CONFIG_TARGET_E2000 is not set */ -/* CONFIG_TARGET_D2000 is not set */ +#define CONFIG_TARGET_D2000 /* end of Board Configuration */ /* Components Configuration */ @@ -37,12 +37,7 @@ /* CONFIG_USE_QSPI is not set */ #define CONFIG_USE_GIC #define CONFIG_ENABLE_GICV3 -#define CONFIG_USE_SERIAL - -/* Usart Configuration */ - -#define CONFIG_ENABLE_Pl011_UART -/* end of Usart Configuration */ +/* CONFIG_USE_SERIAL is not set */ /* CONFIG_USE_GPIO is not set */ /* CONFIG_USE_IOMUX is not set */ #define CONFIG_USE_ETH diff --git a/example/lwip_test/configs/d2000_aarch32_eg_configs b/example/lwip_test/configs/d2000_aarch32_eg_configs new file mode 100644 index 00000000..66efcb4e --- /dev/null +++ b/example/lwip_test/configs/d2000_aarch32_eg_configs @@ -0,0 +1,134 @@ + +# +# Project Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +CONFIG_LWIP_POLL_TEST=y +# CONFIG_LWIP_INTRRUPT_TEST is not set +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +CONFIG_TARGET_ARMV8_AARCH32=y +# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arch Configuration + +# +# Board Configuration +# +# CONFIG_TARGET_F2000_4 is not set +# CONFIG_TARGET_E2000 is not set +CONFIG_TARGET_D2000=y +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +# CONFIG_USE_SERIAL is not set +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +CONFIG_AARCH32_RAM_LD=y +# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +CONFIG_USE_LWIP=y + +# +# LWIP Configuration +# +CONFIG_LWIP_F_GMAC=y +# end of LWIP Configuration +# end of FreeRTOS Setting diff --git a/example/lwip_test/configs/d2000_aarch64_eg_configs b/example/lwip_test/configs/d2000_aarch64_eg_configs new file mode 100644 index 00000000..9398afca --- /dev/null +++ b/example/lwip_test/configs/d2000_aarch64_eg_configs @@ -0,0 +1,128 @@ + +# +# Project Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +CONFIG_LWIP_POLL_TEST=y +# CONFIG_LWIP_INTRRUPT_TEST is not set +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +# end of Arch Configuration + +# +# Board Configuration +# +# CONFIG_TARGET_F2000_4 is not set +# CONFIG_TARGET_E2000 is not set +CONFIG_TARGET_D2000=y +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +# CONFIG_USE_SERIAL is not set +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +CONFIG_USE_LWIP=y + +# +# LWIP Configuration +# +CONFIG_LWIP_F_GMAC=y +# end of LWIP Configuration +# end of FreeRTOS Setting diff --git a/example/lwip_test/sdkconfig b/example/lwip_test/sdkconfig index b9008a9e..9398afca 100644 --- a/example/lwip_test/sdkconfig +++ b/example/lwip_test/sdkconfig @@ -2,7 +2,7 @@ # # Project Configuration # -CONFIG_TARGET_NAME="ft2004_freertos" +CONFIG_TARGET_NAME="d2000_freertos" CONFIG_LWIP_POLL_TEST=y # CONFIG_LWIP_INTRRUPT_TEST is not set # end of Project Configuration @@ -27,9 +27,9 @@ CONFIG_USE_SYS_TICK=y # # Board Configuration # -CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_F2000_4 is not set # CONFIG_TARGET_E2000 is not set -# CONFIG_TARGET_D2000 is not set +CONFIG_TARGET_D2000=y # end of Board Configuration # @@ -39,14 +39,7 @@ CONFIG_TARGET_F2000_4=y # CONFIG_USE_QSPI is not set CONFIG_USE_GIC=y CONFIG_ENABLE_GICV3=y -CONFIG_USE_SERIAL=y - -# -# Usart Configuration -# -CONFIG_ENABLE_Pl011_UART=y -# end of Usart Configuration - +# CONFIG_USE_SERIAL is not set # CONFIG_USE_GPIO is not set # CONFIG_USE_IOMUX is not set CONFIG_USE_ETH=y @@ -89,8 +82,8 @@ CONFIG_GCC_OPTIMIZE_LEVEL=0 # CONFIG_LOG_VERBOS is not set # CONFIG_LOG_DEBUG is not set -# CONFIG_LOG_INFO is not set -CONFIG_LOG_WARN=y +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set # CONFIG_LOG_ERROR is not set # CONFIG_LOG_NONE is not set diff --git a/example/lwip_test/sdkconfig.h b/example/lwip_test/sdkconfig.h index 261a5cc2..31ff1a56 100644 --- a/example/lwip_test/sdkconfig.h +++ b/example/lwip_test/sdkconfig.h @@ -3,7 +3,7 @@ /* Project Configuration */ -#define CONFIG_TARGET_NAME "ft2004_freertos" +#define CONFIG_TARGET_NAME "d2000_freertos" #define CONFIG_LWIP_POLL_TEST /* CONFIG_LWIP_INTRRUPT_TEST is not set */ /* end of Project Configuration */ @@ -25,9 +25,9 @@ /* Board Configuration */ -#define CONFIG_TARGET_F2000_4 +/* CONFIG_TARGET_F2000_4 is not set */ /* CONFIG_TARGET_E2000 is not set */ -/* CONFIG_TARGET_D2000 is not set */ +#define CONFIG_TARGET_D2000 /* end of Board Configuration */ /* Components Configuration */ @@ -36,12 +36,7 @@ /* CONFIG_USE_QSPI is not set */ #define CONFIG_USE_GIC #define CONFIG_ENABLE_GICV3 -#define CONFIG_USE_SERIAL - -/* Usart Configuration */ - -#define CONFIG_ENABLE_Pl011_UART -/* end of Usart Configuration */ +/* CONFIG_USE_SERIAL is not set */ /* CONFIG_USE_GPIO is not set */ /* CONFIG_USE_IOMUX is not set */ #define CONFIG_USE_ETH @@ -77,8 +72,8 @@ /* end of Cross-Compiler Setting */ /* CONFIG_LOG_VERBOS is not set */ /* CONFIG_LOG_DEBUG is not set */ -/* CONFIG_LOG_INFO is not set */ -#define CONFIG_LOG_WARN +#define CONFIG_LOG_INFO +/* CONFIG_LOG_WARN is not set */ /* CONFIG_LOG_ERROR is not set */ /* CONFIG_LOG_NONE is not set */ diff --git a/example/start_up/configs/d2000_aarch32_eg_configs b/example/start_up/configs/d2000_aarch32_eg_configs new file mode 100644 index 00000000..8e72dd20 --- /dev/null +++ b/example/start_up/configs/d2000_aarch32_eg_configs @@ -0,0 +1,142 @@ + +# +# Project Configuration +# + +# +# FT2000-4 AARCH32 FreeRTOS Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +# CONFIG_DEMO_HELLO_WORLD is not set +# CONFIG_DEMO_GET_CPU_STATS is not set +CONFIG_DEMO_MSG_QUEUE=y +# CONFIG_DEMO_SEMAPHORE is not set +# end of FT2000-4 AARCH32 FreeRTOS Configuration +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +CONFIG_TARGET_ARMV8_AARCH32=y +# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +# CONFIG_USE_SYS_TICK is not set +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arch Configuration + +# +# Board Configuration +# +# CONFIG_TARGET_F2000_4 is not set +# CONFIG_TARGET_E2000 is not set +CONFIG_TARGET_D2000=y +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +CONFIG_AARCH32_RAM_LD=y +# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/start_up/configs/d2000_aarch64_eg_configs b/example/start_up/configs/d2000_aarch64_eg_configs new file mode 100644 index 00000000..b249eaa1 --- /dev/null +++ b/example/start_up/configs/d2000_aarch64_eg_configs @@ -0,0 +1,136 @@ + +# +# Project Configuration +# + +# +# FT2000-4 AARCH32 FreeRTOS Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +# CONFIG_DEMO_HELLO_WORLD is not set +# CONFIG_DEMO_GET_CPU_STATS is not set +CONFIG_DEMO_MSG_QUEUE=y +# CONFIG_DEMO_SEMAPHORE is not set +# end of FT2000-4 AARCH32 FreeRTOS Configuration +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +# CONFIG_USE_SYS_TICK is not set +# end of Arch Configuration + +# +# Board Configuration +# +# CONFIG_TARGET_F2000_4 is not set +# CONFIG_TARGET_E2000 is not set +CONFIG_TARGET_D2000=y +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/start_up/sdkconfig b/example/start_up/sdkconfig index 64b0c443..b249eaa1 100644 --- a/example/start_up/sdkconfig +++ b/example/start_up/sdkconfig @@ -6,7 +6,7 @@ # # FT2000-4 AARCH32 FreeRTOS Configuration # -CONFIG_TARGET_NAME="ft2004_freertos" +CONFIG_TARGET_NAME="d2000_freertos" # CONFIG_DEMO_HELLO_WORLD is not set # CONFIG_DEMO_GET_CPU_STATS is not set CONFIG_DEMO_MSG_QUEUE=y @@ -28,15 +28,15 @@ CONFIG_TARGET_ARMV8_AARCH64=y CONFIG_USE_CACHE=y CONFIG_USE_L3CACHE=y CONFIG_USE_MMU=y -CONFIG_USE_SYS_TICK=y +# CONFIG_USE_SYS_TICK is not set # end of Arch Configuration # # Board Configuration # -CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_F2000_4 is not set # CONFIG_TARGET_E2000 is not set -# CONFIG_TARGET_D2000 is not set +CONFIG_TARGET_D2000=y # end of Board Configuration # diff --git a/example/start_up/sdkconfig.h b/example/start_up/sdkconfig.h index c699e58b..ea5cb17a 100644 --- a/example/start_up/sdkconfig.h +++ b/example/start_up/sdkconfig.h @@ -5,7 +5,7 @@ /* FT2000-4 AARCH32 FreeRTOS Configuration */ -#define CONFIG_TARGET_NAME "ft2004_freertos" +#define CONFIG_TARGET_NAME "d2000_freertos" /* CONFIG_DEMO_HELLO_WORLD is not set */ /* CONFIG_DEMO_GET_CPU_STATS is not set */ #define CONFIG_DEMO_MSG_QUEUE @@ -25,14 +25,14 @@ #define CONFIG_USE_CACHE #define CONFIG_USE_L3CACHE #define CONFIG_USE_MMU -#define CONFIG_USE_SYS_TICK +/* CONFIG_USE_SYS_TICK is not set */ /* end of Arch Configuration */ /* Board Configuration */ -#define CONFIG_TARGET_F2000_4 +/* CONFIG_TARGET_F2000_4 is not set */ /* CONFIG_TARGET_E2000 is not set */ -/* CONFIG_TARGET_D2000 is not set */ +#define CONFIG_TARGET_D2000 /* end of Board Configuration */ /* Components Configuration */ diff --git a/example/template/configs/d2000_aarch32_eg_configs b/example/template/configs/d2000_aarch32_eg_configs new file mode 100644 index 00000000..a3bdac43 --- /dev/null +++ b/example/template/configs/d2000_aarch32_eg_configs @@ -0,0 +1,131 @@ + +# +# Project Configuration +# + +# +# Template Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +# end of Template Configuration +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +CONFIG_TARGET_ARMV8_AARCH32=y +# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +# CONFIG_USE_SYS_TICK is not set +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arch Configuration + +# +# Board Configuration +# +# CONFIG_TARGET_F2000_4 is not set +# CONFIG_TARGET_E2000 is not set +CONFIG_TARGET_D2000=y +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +# CONFIG_USE_SERIAL is not set +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +CONFIG_AARCH32_RAM_LD=y +# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/template/configs/d2000_aarch64_eg_configs b/example/template/configs/d2000_aarch64_eg_configs new file mode 100644 index 00000000..fa6ae211 --- /dev/null +++ b/example/template/configs/d2000_aarch64_eg_configs @@ -0,0 +1,125 @@ + +# +# Project Configuration +# + +# +# Template Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +# end of Template Configuration +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +# CONFIG_USE_SYS_TICK is not set +# end of Arch Configuration + +# +# Board Configuration +# +# CONFIG_TARGET_F2000_4 is not set +# CONFIG_TARGET_E2000 is not set +CONFIG_TARGET_D2000=y +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +# CONFIG_USE_SERIAL is not set +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/template/sdkconfig b/example/template/sdkconfig index 4f195517..fa6ae211 100644 --- a/example/template/sdkconfig +++ b/example/template/sdkconfig @@ -6,7 +6,7 @@ # # Template Configuration # -CONFIG_TARGET_NAME="ft2004_freertos" +CONFIG_TARGET_NAME="d2000_freertos" # end of Template Configuration # end of Project Configuration @@ -18,22 +18,21 @@ CONFIG_USE_FREERTOS=y # # Arch Configuration # -CONFIG_TARGET_ARMV8_AARCH32=y -# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y # CONFIG_TARGET_ARMV7 is not set CONFIG_USE_CACHE=y CONFIG_USE_L3CACHE=y CONFIG_USE_MMU=y -CONFIG_USE_SYS_TICK=y -CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# CONFIG_USE_SYS_TICK is not set # end of Arch Configuration # # Board Configuration # -CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_F2000_4 is not set # CONFIG_TARGET_E2000 is not set -# CONFIG_TARGET_D2000 is not set +CONFIG_TARGET_D2000=y # end of Board Configuration # @@ -43,14 +42,7 @@ CONFIG_TARGET_F2000_4=y # CONFIG_USE_QSPI is not set CONFIG_USE_GIC=y CONFIG_ENABLE_GICV3=y -CONFIG_USE_SERIAL=y - -# -# Usart Configuration -# -CONFIG_ENABLE_Pl011_UART=y -# end of Usart Configuration - +# CONFIG_USE_SERIAL is not set # CONFIG_USE_GPIO is not set # CONFIG_USE_IOMUX is not set CONFIG_USE_ETH=y @@ -101,8 +93,8 @@ CONFIG_LOG_INFO=y # # Linker Options # -CONFIG_AARCH32_RAM_LD=y -# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y # CONFIG_USER_DEFINED_LD is not set CONFIG_LINK_SCRIPT_ROM=y CONFIG_ROM_START_UP_ADDR=0x80100000 @@ -111,12 +103,7 @@ CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 CONFIG_HEAP_SIZE=1 -CONFIG_SVC_STACK_SIZE=0x1000 -CONFIG_SYS_STACK_SIZE=0x1000 -CONFIG_IRQ_STACK_SIZE=0x1000 -CONFIG_ABORT_STACK_SIZE=0x1000 -CONFIG_FIQ_STACK_SIZE=0x1000 -CONFIG_UNDEF_STACK_SIZE=0x1000 +CONFIG_STACK_SIZE=0x400 # end of Linker Options # end of Building Option diff --git a/example/template/sdkconfig.h b/example/template/sdkconfig.h index ac92b721..fdb8d1c4 100644 --- a/example/template/sdkconfig.h +++ b/example/template/sdkconfig.h @@ -5,7 +5,7 @@ /* Template Configuration */ -#define CONFIG_TARGET_NAME "ft2004_freertos" +#define CONFIG_TARGET_NAME "d2000_freertos" /* end of Template Configuration */ /* end of Project Configuration */ @@ -15,21 +15,20 @@ /* Arch Configuration */ -#define CONFIG_TARGET_ARMV8_AARCH32 -/* CONFIG_TARGET_ARMV8_AARCH64 is not set */ +/* CONFIG_TARGET_ARMV8_AARCH32 is not set */ +#define CONFIG_TARGET_ARMV8_AARCH64 /* CONFIG_TARGET_ARMV7 is not set */ #define CONFIG_USE_CACHE #define CONFIG_USE_L3CACHE #define CONFIG_USE_MMU -#define CONFIG_USE_SYS_TICK -#define CONFIG_USE_AARCH64_L1_TO_AARCH32 +/* CONFIG_USE_SYS_TICK is not set */ /* end of Arch Configuration */ /* Board Configuration */ -#define CONFIG_TARGET_F2000_4 +/* CONFIG_TARGET_F2000_4 is not set */ /* CONFIG_TARGET_E2000 is not set */ -/* CONFIG_TARGET_D2000 is not set */ +#define CONFIG_TARGET_D2000 /* end of Board Configuration */ /* Components Configuration */ @@ -38,12 +37,7 @@ /* CONFIG_USE_QSPI is not set */ #define CONFIG_USE_GIC #define CONFIG_ENABLE_GICV3 -#define CONFIG_USE_SERIAL - -/* Usart Configuration */ - -#define CONFIG_ENABLE_Pl011_UART -/* end of Usart Configuration */ +/* CONFIG_USE_SERIAL is not set */ /* CONFIG_USE_GPIO is not set */ /* CONFIG_USE_IOMUX is not set */ #define CONFIG_USE_ETH @@ -86,8 +80,8 @@ /* Linker Options */ -#define CONFIG_AARCH32_RAM_LD -/* CONFIG_AARCH64_RAM_LD is not set */ +/* CONFIG_AARCH32_RAM_LD is not set */ +#define CONFIG_AARCH64_RAM_LD /* CONFIG_USER_DEFINED_LD is not set */ #define CONFIG_LINK_SCRIPT_ROM #define CONFIG_ROM_START_UP_ADDR 0x80100000 @@ -96,12 +90,7 @@ #define CONFIG_RAM_START_UP_ADDR 0x81000000 #define CONFIG_RAM_SIZE_MB 64 #define CONFIG_HEAP_SIZE 1 -#define CONFIG_SVC_STACK_SIZE 0x1000 -#define CONFIG_SYS_STACK_SIZE 0x1000 -#define CONFIG_IRQ_STACK_SIZE 0x1000 -#define CONFIG_ABORT_STACK_SIZE 0x1000 -#define CONFIG_FIQ_STACK_SIZE 0x1000 -#define CONFIG_UNDEF_STACK_SIZE 0x1000 +#define CONFIG_STACK_SIZE 0x400 /* end of Linker Options */ /* end of Building Option */ diff --git a/make/menuconfig.mk b/make/menuconfig.mk index 959b6949..61433c51 100755 --- a/make/menuconfig.mk +++ b/make/menuconfig.mk @@ -38,6 +38,11 @@ lddefconfig: @cp $(FREERTOS_SDK_ROOT)/configs/$(DEF_KCONFIG) ./$(KCONFIG_CONFIG) -f @echo "get default configs at " $(FREERTOS_SDK_ROOT)/configs/$(DEF_KCONFIG) +ldconfig: + cp $(LDCONFIG_ARG) ./$(KCONFIG_CONFIG) -f + @echo "get configs at " $(LDCONFIG_ARG) + $(STANDALONE_DIR)/lib/Kconfiglib/genconfig.py + # load default configs,then generate sdkconfig.h, and clean build targets # support platform # FT2000/4 AARCH32/AARCH64 -- Gitee From 2038544543cb315a4d5999d51ffabfc428a344b6 Mon Sep 17 00:00:00 2001 From: wxd <15576600345@qq.com> Date: Thu, 23 Dec 2021 15:59:26 +0800 Subject: [PATCH 09/14] d2000 test ok --- docs/Changlog.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/Changlog.md b/docs/Changlog.md index 7d93c22a..70b22bbb 100644 --- a/docs/Changlog.md +++ b/docs/Changlog.md @@ -11,6 +11,15 @@ * Ver   Who        Date         Changes * ----- ------     --------    -------------------------------------- --> +# Phytium FreeRTOS SDK v0.0.6 ChangeLog + +Change Log sinc 0.0.5, 2021.12.23 + +## example + +- adapt to the new standalone sdk v0.1.15 +- reconstruct the aarch framework for freertos + # Phytium FreeRTOS SDK v0.0.5 ChangeLog Change Log sinc 0.0.4, 2021.11.2 -- Gitee From 1b1fcfb6990a0ad67cd9335ef29403d1aea7e215 Mon Sep 17 00:00:00 2001 From: wxd <15576600345@qq.com> Date: Thu, 23 Dec 2021 17:00:01 +0800 Subject: [PATCH 10/14] del redundance --- .vscode/settings.json | 52 ----- .../configs/d2000_aarch64_eg_configs | 2 +- .../configs/ft2004_aarch64_eg_configs | 2 +- example/freertos_test/sdkconfig | 2 +- .../configs/d2000_aarch64_eg_configs | 2 +- .../configs/ft2004_aarch64_eg_configs | 2 +- example/function_test/sdkconfig | 2 +- .../configs/d2000_aarch64_eg_configs | 2 +- .../configs/ft2004_aarch64_eg_configs | 2 +- .../configs/d2000_aarch64_eg_configs | 2 +- .../configs/ft2004_aarch64_eg_configs | 2 +- example/lwip_test/sdkconfig | 2 +- .../start_up/configs/d2000_aarch64_eg_configs | 2 +- .../configs/ft2004_aarch64_eg_configs | 2 +- .../template/configs/d2000_aarch64_eg_configs | 2 +- .../configs/ft2004_aarch64_eg_configs | 2 +- example/template/sdkconfig | 2 +- make/ld/Kconfig | 2 +- standalone | 1 - .../freertos/portable/freertos_configs.c_o | 194 ------------------ third-party/freertos/timers.c | 1 - 21 files changed, 17 insertions(+), 265 deletions(-) delete mode 100644 .vscode/settings.json delete mode 160000 standalone delete mode 100644 third-party/freertos/portable/freertos_configs.c_o diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index c17b3cc0..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "files.associations": { - "freertos.h": "c", - "generic_timer.h": "c", - "ft_types.h": "c", - "ft_assert.h": "c", - "queue.h": "c", - "*.tcc": "c", - "ft_debug.h": "c", - "pl011_uart.h": "c", - "gicv3.h": "c", - "interrupt.h": "c", - "task.h": "c", - "trap.h": "c", - "parameters.h": "c", - "ip4_addr.h": "c", - "gmac_hw.h": "c", - "sdkconfig.h": "c", - "timeouts.h": "c", - "fsleep.h": "c", - "freertosconfig.h": "c", - "mem.h": "c", - "ft_os_gmac.h": "c", - "gmac.h": "c", - "list.h": "c", - "netif.h": "c", - "system_error": "cpp", - "functional": "c", - "event_groups.h": "c", - "condition_variable": "c", - "future": "c", - "stats.h": "c", - "aarch32.h": "c", - "aarch64.h": "c", - "gmac_dma.h": "c", - "debug.h": "c", - "ethernetif.h": "c", - "tcpip.h": "c", - "init.h": "c", - "ethernet.h": "c", - "stdio.h": "c", - "semphr.h": "c", - "portmacro.h": "c", - "fwdt.h": "c", - "fpl011.h": "c", - "lwipopts.h": "c", - "errno.h": "c", - "dhcp.h": "c", - "fgmac_hw.h": "c", - "fgmac.h": "c" - } -} \ No newline at end of file diff --git a/example/freertos_test/configs/d2000_aarch64_eg_configs b/example/freertos_test/configs/d2000_aarch64_eg_configs index 1bf5efe6..f83c5237 100644 --- a/example/freertos_test/configs/d2000_aarch64_eg_configs +++ b/example/freertos_test/configs/d2000_aarch64_eg_configs @@ -107,7 +107,7 @@ CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 CONFIG_HEAP_SIZE=1 -CONFIG_STACK_SIZE=0x400 +CONFIG_STACK_SIZE=0x100000 # end of Linker Options # end of Building Option diff --git a/example/freertos_test/configs/ft2004_aarch64_eg_configs b/example/freertos_test/configs/ft2004_aarch64_eg_configs index 0ff4d4c3..273b8742 100644 --- a/example/freertos_test/configs/ft2004_aarch64_eg_configs +++ b/example/freertos_test/configs/ft2004_aarch64_eg_configs @@ -107,7 +107,7 @@ CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 CONFIG_HEAP_SIZE=1 -CONFIG_STACK_SIZE=0x400 +CONFIG_STACK_SIZE=0x100000 # end of Linker Options # end of Building Option diff --git a/example/freertos_test/sdkconfig b/example/freertos_test/sdkconfig index 1bf5efe6..f83c5237 100644 --- a/example/freertos_test/sdkconfig +++ b/example/freertos_test/sdkconfig @@ -107,7 +107,7 @@ CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 CONFIG_HEAP_SIZE=1 -CONFIG_STACK_SIZE=0x400 +CONFIG_STACK_SIZE=0x100000 # end of Linker Options # end of Building Option diff --git a/example/function_test/configs/d2000_aarch64_eg_configs b/example/function_test/configs/d2000_aarch64_eg_configs index e60f19fe..5e3e88df 100644 --- a/example/function_test/configs/d2000_aarch64_eg_configs +++ b/example/function_test/configs/d2000_aarch64_eg_configs @@ -105,7 +105,7 @@ CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 CONFIG_HEAP_SIZE=1 -CONFIG_STACK_SIZE=0x400 +CONFIG_STACK_SIZE=0x100000 # end of Linker Options # end of Building Option diff --git a/example/function_test/configs/ft2004_aarch64_eg_configs b/example/function_test/configs/ft2004_aarch64_eg_configs index eaa277e2..ffdfab41 100644 --- a/example/function_test/configs/ft2004_aarch64_eg_configs +++ b/example/function_test/configs/ft2004_aarch64_eg_configs @@ -105,7 +105,7 @@ CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 CONFIG_HEAP_SIZE=1 -CONFIG_STACK_SIZE=0x400 +CONFIG_STACK_SIZE=0x100000 # end of Linker Options # end of Building Option diff --git a/example/function_test/sdkconfig b/example/function_test/sdkconfig index e60f19fe..5e3e88df 100644 --- a/example/function_test/sdkconfig +++ b/example/function_test/sdkconfig @@ -105,7 +105,7 @@ CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 CONFIG_HEAP_SIZE=1 -CONFIG_STACK_SIZE=0x400 +CONFIG_STACK_SIZE=0x100000 # end of Linker Options # end of Building Option diff --git a/example/hello_world/configs/d2000_aarch64_eg_configs b/example/hello_world/configs/d2000_aarch64_eg_configs index 8180c819..49b6b8cf 100644 --- a/example/hello_world/configs/d2000_aarch64_eg_configs +++ b/example/hello_world/configs/d2000_aarch64_eg_configs @@ -103,7 +103,7 @@ CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 CONFIG_HEAP_SIZE=1 -CONFIG_STACK_SIZE=0x400 +CONFIG_STACK_SIZE=0x100000 # end of Linker Options # end of Building Option diff --git a/example/hello_world/configs/ft2004_aarch64_eg_configs b/example/hello_world/configs/ft2004_aarch64_eg_configs index 2ef9b357..827547a4 100644 --- a/example/hello_world/configs/ft2004_aarch64_eg_configs +++ b/example/hello_world/configs/ft2004_aarch64_eg_configs @@ -110,7 +110,7 @@ CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 CONFIG_HEAP_SIZE=1 -CONFIG_STACK_SIZE=0x400 +CONFIG_STACK_SIZE=0x100000 # end of Linker Options # end of Building Option diff --git a/example/lwip_test/configs/d2000_aarch64_eg_configs b/example/lwip_test/configs/d2000_aarch64_eg_configs index 9398afca..2f0570a8 100644 --- a/example/lwip_test/configs/d2000_aarch64_eg_configs +++ b/example/lwip_test/configs/d2000_aarch64_eg_configs @@ -100,7 +100,7 @@ CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 CONFIG_HEAP_SIZE=1 -CONFIG_STACK_SIZE=0x400 +CONFIG_STACK_SIZE=0x100000 # end of Linker Options # end of Building Option diff --git a/example/lwip_test/configs/ft2004_aarch64_eg_configs b/example/lwip_test/configs/ft2004_aarch64_eg_configs index b9008a9e..02db22b6 100644 --- a/example/lwip_test/configs/ft2004_aarch64_eg_configs +++ b/example/lwip_test/configs/ft2004_aarch64_eg_configs @@ -107,7 +107,7 @@ CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 CONFIG_HEAP_SIZE=1 -CONFIG_STACK_SIZE=0x400 +CONFIG_STACK_SIZE=0x100000 # end of Linker Options # end of Building Option diff --git a/example/lwip_test/sdkconfig b/example/lwip_test/sdkconfig index 9398afca..2f0570a8 100644 --- a/example/lwip_test/sdkconfig +++ b/example/lwip_test/sdkconfig @@ -100,7 +100,7 @@ CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 CONFIG_HEAP_SIZE=1 -CONFIG_STACK_SIZE=0x400 +CONFIG_STACK_SIZE=0x100000 # end of Linker Options # end of Building Option diff --git a/example/start_up/configs/d2000_aarch64_eg_configs b/example/start_up/configs/d2000_aarch64_eg_configs index b249eaa1..1ac5110c 100644 --- a/example/start_up/configs/d2000_aarch64_eg_configs +++ b/example/start_up/configs/d2000_aarch64_eg_configs @@ -114,7 +114,7 @@ CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 CONFIG_HEAP_SIZE=1 -CONFIG_STACK_SIZE=0x400 +CONFIG_STACK_SIZE=0x100000 # end of Linker Options # end of Building Option diff --git a/example/start_up/configs/ft2004_aarch64_eg_configs b/example/start_up/configs/ft2004_aarch64_eg_configs index 64b0c443..f22d58d7 100644 --- a/example/start_up/configs/ft2004_aarch64_eg_configs +++ b/example/start_up/configs/ft2004_aarch64_eg_configs @@ -114,7 +114,7 @@ CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 CONFIG_HEAP_SIZE=1 -CONFIG_STACK_SIZE=0x400 +CONFIG_STACK_SIZE=0x100000 # end of Linker Options # end of Building Option diff --git a/example/template/configs/d2000_aarch64_eg_configs b/example/template/configs/d2000_aarch64_eg_configs index fa6ae211..fde19b62 100644 --- a/example/template/configs/d2000_aarch64_eg_configs +++ b/example/template/configs/d2000_aarch64_eg_configs @@ -103,7 +103,7 @@ CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 CONFIG_HEAP_SIZE=1 -CONFIG_STACK_SIZE=0x400 +CONFIG_STACK_SIZE=0x100000 # end of Linker Options # end of Building Option diff --git a/example/template/configs/ft2004_aarch64_eg_configs b/example/template/configs/ft2004_aarch64_eg_configs index 54f116ae..57941cf4 100644 --- a/example/template/configs/ft2004_aarch64_eg_configs +++ b/example/template/configs/ft2004_aarch64_eg_configs @@ -110,7 +110,7 @@ CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 CONFIG_HEAP_SIZE=1 -CONFIG_STACK_SIZE=0x400 +CONFIG_STACK_SIZE=0x100000 # end of Linker Options # end of Building Option diff --git a/example/template/sdkconfig b/example/template/sdkconfig index fa6ae211..fde19b62 100644 --- a/example/template/sdkconfig +++ b/example/template/sdkconfig @@ -103,7 +103,7 @@ CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 CONFIG_HEAP_SIZE=1 -CONFIG_STACK_SIZE=0x400 +CONFIG_STACK_SIZE=0x100000 # end of Linker Options # end of Building Option diff --git a/make/ld/Kconfig b/make/ld/Kconfig index b0364eba..431b8a4e 100644 --- a/make/ld/Kconfig +++ b/make/ld/Kconfig @@ -70,7 +70,7 @@ menu "Linker Options" config STACK_SIZE hex "Stack Size (Byte)" - default "0x400" + default "0x100000" depends on AARCH64_RAM_LD help Assign Stack size in Linkscript diff --git a/standalone b/standalone deleted file mode 160000 index 49cf0988..00000000 --- a/standalone +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 49cf098844a142d23344253410856a727a36b416 diff --git a/third-party/freertos/portable/freertos_configs.c_o b/third-party/freertos/portable/freertos_configs.c_o deleted file mode 100644 index 84b3ede1..00000000 --- a/third-party/freertos/portable/freertos_configs.c_o +++ /dev/null @@ -1,194 +0,0 @@ -/* - * @ : Copyright (c) 2021 Phytium Information Technology, Inc. - * - * SPDX-License-Identifier: Apache-2.0. - * - * @Date: 2021-07-05 08:35:41 - * @LastEditTime: 2021-12-15 15:51:41 - * @Description:  This files is for - * - * @Modify History: - * Ver   Who        Date         Changes - * ----- ------     --------    -------------------------------------- - */ -#include "FreeRTOS.h" -#include "task.h" -#include "ft_types.h" -#include "parameters.h" -#include "gicv3.h" -#include "generic_timer.h" -#include "interrupt.h" -#include "trap.h" -#include -#include "ft_assert.h" - -void vMainAssertCalled(const char *pcFileName, uint32_t ulLineNumber) -{ - printf("Assert Error is %s : %d \r\n", pcFileName, ulLineNumber); - for (;;) - ; -} - -void vApplicationMallocFailedHook(void) -{ - printf("Malloc Failed\r\n"); - while (1) - ; -} - -void vApplicationTickHook(void) -{ - -} - -void vApplicationIdleHook(void) -{ - -} - -u32 PlatformGetGicDistBase(void) -{ - return GICV3_BASEADDRESS; -} - -static u32 cntfrq; /* System frequency */ - -void vConfigureTickInterrupt(void) -{ - // Disable the timer - GenericTimerStop(); - // Get system frequency - cntfrq = GenericTimerFrequecy(); - - // Set tick rate - GenericTimerCompare(cntfrq / configTICK_RATE_HZ); - GenericTimerInterruptEnable(); - - // Set as the lowest priority - InterruptSetPriority(GENERIC_TIMER_NS_IRQ_NUM, configKERNEL_INTERRUPT_PRIORITY); - InterruptUmask(GENERIC_TIMER_NS_IRQ_NUM); - - GenericTimerStart(); -} - -void vClearTickInterrupt(void) -{ - GenericTimerCompare(cntfrq / configTICK_RATE_HZ); -} - -volatile unsigned int gCpuRuntime; - -#ifdef __aarch64__ -void vApplicationIRQHandler(uint32_t ulICCIAR) -{ - int ulInterruptID; - - /* Interrupts cannot be re-enabled until the source of the interrupt is - cleared. The ID of the interrupt is obtained by bitwise ANDing the ICCIAR - value with 0x3FF. */ - ulInterruptID = ulICCIAR & 0x3FFUL; - - /* call handler function */ - if (ulInterruptID == 30) - { - /* Generic Timer */ - gCpuRuntime++; - FreeRTOS_Tick_Handler(); - } - else - { - SystemIrqHandler(ulInterruptID); - } -} -#else -void vApplicationFPUSafeIRQHandler(uint32_t ulICCIAR) -{ - int ulInterruptID; - - /* Interrupts cannot be re-enabled until the source of the interrupt is - cleared. The ID of the interrupt is obtained by bitwise ANDing the ICCIAR - value with 0x3FF. */ - ulInterruptID = ulICCIAR & 0x3FFUL; - - /* call handler function */ - if (ulInterruptID == 30) - { - /* Generic Timer */ - gCpuRuntime++; - FreeRTOS_Tick_Handler(); - - } - else - { - SystemIrqHandler(ulInterruptID); - } -} -#endif - - - -void InitIrq() -{ - /* interrupt init */ - ArmGicRedistAddressSet(0, GICV3_RD_BASEADDRESS + 0, 0); - InterruptInit(GICV3_BASEADDRESS, 0); -} - - -void vApplicationStackOverflowHook(xTaskHandle pxTask, signed char *pcTaskName) -{ - (void) pxTask; - (void) pcTaskName; - - taskDISABLE_INTERRUPTS(); - FT_ASSERTNONERETURN(FALSE); - -} - -/* configSUPPORT_STATIC_ALLOCATION is set to 1, so the application must provide an - * implementation of vApplicationGetIdleTaskMemory() to provide the memory that is - * used by the Idle task. */ -void vApplicationGetIdleTaskMemory( StaticTask_t **ppxIdleTaskTCBBuffer, StackType_t **ppxIdleTaskStackBuffer, uint32_t *pulIdleTaskStackSize ) -{ - /* If the buffers to be provided to the Idle task are declared inside this - * function then they must be declared static - otherwise they will be allocated on - * the stack and so not exists after this function exits. */ - static StaticTask_t xIdleTaskTCB; - static StackType_t uxIdleTaskStack[ configMINIMAL_STACK_SIZE ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Idle task's - state will be stored. */ - *ppxIdleTaskTCBBuffer = &xIdleTaskTCB; - - /* Pass out the array that will be used as the Idle task's stack. */ - *ppxIdleTaskStackBuffer = uxIdleTaskStack; - - /* Pass out the size of the array pointed to by *ppxIdleTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configMINIMAL_STACK_SIZE is specified in words, not bytes. */ - *pulIdleTaskStackSize = configMINIMAL_STACK_SIZE; -} - -/* configSUPPORT_STATIC_ALLOCATION and configUSE_TIMERS are both set to 1, so the - * application must provide an implementation of vApplicationGetTimerTaskMemory() - * to provide the memory that is used by the Timer service task. */ -void vApplicationGetTimerTaskMemory( StaticTask_t **ppxTimerTaskTCBBuffer, StackType_t **ppxTimerTaskStackBuffer, uint32_t *pulTimerTaskStackSize ) -{ - /* If the buffers to be provided to the Timer task are declared inside this - * function then they must be declared static - otherwise they will be allocated on - * the stack and so not exists after this function exits. */ - static StaticTask_t xTimerTaskTCB; - static StackType_t uxTimerTaskStack[ configTIMER_TASK_STACK_DEPTH ]; - - /* Pass out a pointer to the StaticTask_t structure in which the Timer - task's state will be stored. */ - *ppxTimerTaskTCBBuffer = &xTimerTaskTCB; - - /* Pass out the array that will be used as the Timer task's stack. */ - *ppxTimerTaskStackBuffer = uxTimerTaskStack; - - /* Pass out the size of the array pointed to by *ppxTimerTaskStackBuffer. - Note that, as the array is necessarily of type StackType_t, - configTIMER_TASK_STACK_DEPTH is specified in words, not bytes. */ - *pulTimerTaskStackSize = configTIMER_TASK_STACK_DEPTH; -} diff --git a/third-party/freertos/timers.c b/third-party/freertos/timers.c index 92bfb540..ab2f1069 100644 --- a/third-party/freertos/timers.c +++ b/third-party/freertos/timers.c @@ -27,7 +27,6 @@ /* Standard includes. */ #include -#include /* Defining MPU_WRAPPERS_INCLUDED_FROM_API_FILE prevents task.h from redefining all the API functions to use the MPU wrappers. That should only be done when -- Gitee From 74bb8106f06f2736a7490c8eb887cc284585bd8b Mon Sep 17 00:00:00 2001 From: wxd <15576600345@qq.com> Date: Thu, 23 Dec 2021 17:04:14 +0800 Subject: [PATCH 11/14] modify --- .gitlab/README_TEMPLATE.zh-CN.md | 50 ++++++++++++++++++ .../issue_templates/ISSUE_TEMPLATE.zh-CN.md | 13 +++++ .../PULL_REQUEST_TEMPLATE.md | 45 ++++++++++++++++ git | Bin 20480 -> 0 bytes .../freertos/portable/freertos_configs.c | 31 +++++------ 5 files changed, 124 insertions(+), 15 deletions(-) create mode 100644 .gitlab/README_TEMPLATE.zh-CN.md create mode 100644 .gitlab/issue_templates/ISSUE_TEMPLATE.zh-CN.md create mode 100644 .gitlab/merge_request_templates/PULL_REQUEST_TEMPLATE.md delete mode 100644 git diff --git a/.gitlab/README_TEMPLATE.zh-CN.md b/.gitlab/README_TEMPLATE.zh-CN.md new file mode 100644 index 00000000..547b7011 --- /dev/null +++ b/.gitlab/README_TEMPLATE.zh-CN.md @@ -0,0 +1,50 @@ + +# XXX + +## 1. 例程介绍 + +>介绍例程的用途,使用场景,相关基本概念,描述用户可以使用例程完成哪些工作
+ +## 2. 如何使用例程 + +>描述开发平台准备,使用例程配置,构建和下载镜像的过程
+ +### 2.1 硬件配置方法 + +>哪些硬件平台是支持的,需要哪些外设,例程与开发板哪些IO口相关等(建议附录开发板照片,展示哪些IO口被引出)
+ +### 2.2 SDK配置方法 + +>依赖哪些驱动、库和第三方组件,如何完成配置(列出需要使能的关键配置项)
+ +### 2.3 构建和下载 + +>描述构建、烧录下载镜像的过程,列出相关的命令
+ +### 2.4 输出与实验现象 + +>描述输入输出情况,列出存在哪些输出,对应的输出是什么(建议附录相关现象图片)
+ +## 3. 如何解决问题 + +>主要记录使用例程中可能会遇到的问题,给出相应的解决方案
+ +## 4. 修改历史记录 + +>记录例程的重大修改记录,标明修改发生的版本号
+ + + + diff --git a/.gitlab/issue_templates/ISSUE_TEMPLATE.zh-CN.md b/.gitlab/issue_templates/ISSUE_TEMPLATE.zh-CN.md new file mode 100644 index 00000000..f09d98dd --- /dev/null +++ b/.gitlab/issue_templates/ISSUE_TEMPLATE.zh-CN.md @@ -0,0 +1,13 @@ +### 该问题是怎么引起的? + + + +### 重现步骤 + + + +### 报错信息 + + + + diff --git a/.gitlab/merge_request_templates/PULL_REQUEST_TEMPLATE.md b/.gitlab/merge_request_templates/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..55b8b555 --- /dev/null +++ b/.gitlab/merge_request_templates/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,45 @@ + +## 拉取/合并请求描述: + +[ +这段方括号里的内容是您**必须填写并替换掉**的,否则PR不可能被合并。**方括号外面的内容不需要修改,但请仔细阅读。** +请在这里填写您的PR描述,可以包括以下之一的内容: +为什么提交这份PR;解决的问题是什么,你的解决方案是什么; +并确认并列出已经在什么情况或板卡上进行了测试; +并且附上测试结果于测试流程,如果代码存在耦合,则需要对耦合部分进行修改。 + +] + + +以下的内容不应该在提交PR时的message修改,修改下述message,PR会被直接关闭。请在提交PR后,浏览器查看PR并对以下检查项逐项check,没问题后逐条在页面上打钩。 + +### 当前拉取/合并请求的状态 + +必须选择一项 : + +- [ ] 本拉取/合并请求是一个草稿版本 +- [ ] 本拉取/合并请求是一个成熟版本 + +### 代码质量 Code Quality: + +我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following: + +- [ ] 已经仔细查看过代码改动的对比 Already check the difference between PR and old code +- [ ] 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles +- [ ] 没有垃圾代码,代码尽量精简,不包含`#if 0`代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up +- [ ] 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP +- [ ] 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky +- [ ] 本拉取/合并请求代码是高质量的 Code in this PR is of high quality +- [ ] 本拉取/合并符合[代码规范](../documentation/coding_style_cn.md) diff --git a/git b/git deleted file mode 100644 index b60f6d1350f88a370e572d075ecba4f046a6d4ed..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 20480 zcmeIuu?~YE6a`Q|g)cC?iuHRsHJwb9{(o_(Lu1m(?cC*&OCWHD=c^6vv8D@Cdgggf z`|SCdx4L&xW4ezu$`q+Y#8^@;7ryDZ`n~nv=bYAMX-9do__u#@L`8rA0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly eK!5-N0t5&UAV7cs0RjXF5FkK+009C7z5*Y@)e@fo diff --git a/third-party/freertos/portable/freertos_configs.c b/third-party/freertos/portable/freertos_configs.c index c990e564..97cef5a6 100644 --- a/third-party/freertos/portable/freertos_configs.c +++ b/third-party/freertos/portable/freertos_configs.c @@ -78,21 +78,22 @@ void vClearTickInterrupt(void) static void vFIrqHandler(int ir) { - void *param; - IrqHandler isr_func; - extern struct IrqDesc isr_table[]; - - /* get interrupt service routine */ - isr_func = isr_table[ir].handler; - if (isr_func) - { - /* Interrupt for myself. */ - param = isr_table[ir].param; - /* turn to interrupt service routine */ - isr_func(ir, param); - } - /* end of interrupt */ - InterruptAck(ir); + void *param; + IrqHandler isr_func; + extern struct IrqDesc isr_table[]; + + /* get interrupt service routine */ + isr_func = isr_table[ir].handler; + if (isr_func) + { + /* Interrupt for myself. */ + param = isr_table[ir].param; + /* turn to interrupt service routine */ + isr_func(ir, param); + } + + /* end of interrupt */ + InterruptAck(ir); } volatile unsigned int gCpuRuntime; -- Gitee From cda9a434831352d1f8b43f6b252dbcab495bb027 Mon Sep 17 00:00:00 2001 From: wxd <15576600345@qq.com> Date: Thu, 23 Dec 2021 17:25:05 +0800 Subject: [PATCH 12/14] modify uart.c --- drivers/ft_os_uart.c | 125 ------------------------------------------- 1 file changed, 125 deletions(-) diff --git a/drivers/ft_os_uart.c b/drivers/ft_os_uart.c index 148b5f9b..674ac4c6 100644 --- a/drivers/ft_os_uart.c +++ b/drivers/ft_os_uart.c @@ -152,93 +152,6 @@ s32 FtFreertosUartReceiveBuffer(FtFreertosUart *uart_p, u8 *buffer, u32 length, return ret; } -// s32 Ft_Os_UartReceiveBuffer(Ft_Os_Uart *OsUartPtr, u8 *buffer, u32 length, u32 *Received) -// { -// u32 GetLength; -// Ft_Uart *UartPtr; -// EventBits_t ev; -// s32 ret; -// if (NULL == OsUartPtr) -// { -// return FST_INSTANCE_NOT_FOUND; -// } - -// if (NULL == buffer) -// { -// return FST_FAILURE; -// } - -// if (NULL == Received) -// { -// return FST_FAILURE; -// } - -// if (0 == length) -// { -// *Received = 0; -// return FST_SUCCESS; -// } - -// UartPtr = &OsUartPtr->UartObj; - -// /* New transfer can be performed only after current one is finished */ -// if (pdFALSE == xSemaphoreTake(OsUartPtr->rxSemaphore, portMAX_DELAY)) -// { -// /* We could not take the semaphore, exit with 0 data received */ -// ret = FST_FAILURE; -// } - -// GetLength = FUart_Receive(UartPtr, buffer, length); -// if (GetLength > 0) -// { -// *Received = GetLength; -// ret = FST_SUCCESS; -// } -// else -// { -// u32 RegTemp; - -// RegTemp = FUart_GetInterruptMask(UartPtr); -// RegTemp |= UARTMIS_RTMIS; -// FUart_SetInterruptMask(UartPtr, RegTemp); - -// ev = xEventGroupWaitBits(OsUartPtr->rxEvent, -// RTOS_UART_COMPLETE | RTOS_UART_HARDWARE_BUFFER_OVERRUN | RTOS_UART_RECV_ERROR, -// pdTRUE, pdFALSE, portMAX_DELAY); - -// if (ev & RTOS_UART_HARDWARE_BUFFER_OVERRUN) -// { -// ret = FST_FIFO_ERROR; -// *Received = 0; -// } -// else if (ev & RTOS_UART_COMPLETE) -// { -// ret = FST_SUCCESS; -// *Received = UartPtr->ReceiveBuffer.RequestedBytes - UartPtr->ReceiveBuffer.RemainingBytes; -// } -// else if (ev & RTOS_UART_RECV_ERROR) -// { -// ret = FST_RECV_ERROR; -// *Received = 0; -// } -// else -// { -// ret = FST_INVALID_PARAM; -// *Received = 0; -// } -// } - -// /* Enable next transfer. Current one is finished */ -// if (pdFALSE == xSemaphoreGive(OsUartPtr->rxSemaphore)) -// { -// /* We could not post the semaphore, exit with error */ -// Ft_printf("FST_FAILURE xSemaphoreGive \r\n"); -// ret = FST_FAILURE; -// } - -// return ret; -// } - s32 FtFreertosUartBlcokingSend(FtFreertosUart *uart_p, u8 *buffer, u32 length) { ft_error_t ret = FT_SUCCESS; @@ -269,43 +182,5 @@ s32 FtFreertosUartBlcokingSend(FtFreertosUart *uart_p, u8 *buffer, u32 length) return ret; } -// s32 Ft_Os_UartBlockingSend(Ft_Os_Uart *OsUartPtr, u8 *buffer, u32 length) -// { -// s32 ret = FST_SUCCESS; -// Ft_Uart *UartPtr; -// EventBits_t ev; -// if (NULL == OsUartPtr) -// { -// return FST_INSTANCE_NOT_FOUND; -// } - -// if (NULL == buffer) -// { -// return FST_FAILURE; -// } - -// UartPtr = &OsUartPtr->UartObj; - -// if (pdFALSE == xSemaphoreTake(OsUartPtr->txSemaphore, portMAX_DELAY)) -// { -// return FST_FAILURE; -// } - -// FUart_Send(UartPtr, buffer, length); - -// ev = xEventGroupWaitBits(OsUartPtr->txEvent, RTOS_UART_COMPLETE, pdTRUE, pdFALSE, portMAX_DELAY); -// if (!(ev & RTOS_UART_COMPLETE)) -// { -// ret = FST_FAILURE; -// } - -// if (pdFALSE == xSemaphoreGive(OsUartPtr->txSemaphore)) -// { -// /* We could not post the semaphore, exit with error */ -// ret = FST_FAILURE; -// } - -// return ret; -// } #endif -- Gitee From a391b63bb18eb717d9510a1fec107bdf4a8f3d71 Mon Sep 17 00:00:00 2001 From: wxd <15576600345@qq.com> Date: Fri, 24 Dec 2021 10:42:41 +0800 Subject: [PATCH 13/14] ok --- .../lwip-2.1.2/ports/f_gmac/ethernetif.c | 17 ++++++----------- .../lwip-2.1.2/ports/f_gmac/ft_os_gmac.c | 4 ++-- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/third-party/lwip-2.1.2/ports/f_gmac/ethernetif.c b/third-party/lwip-2.1.2/ports/f_gmac/ethernetif.c index f68af0c3..b6bcc95c 100644 --- a/third-party/lwip-2.1.2/ports/f_gmac/ethernetif.c +++ b/third-party/lwip-2.1.2/ports/f_gmac/ethernetif.c @@ -215,7 +215,7 @@ static void low_level_init(struct netif *netif) u32 reg_value = 0; LWIP_ASSERT("netif != NULL", (netif != NULL)); u32 ret = FGMAC_SUCCESS; - FGmacMacAddr mac_addr; + FGmacMacAddr mac_addr; FGmac *p_ctrl; FtOsGmac *os_gmac_ptr; os_gmac_ptr = container_of(netif, FtOsGmac, netif_object); @@ -223,9 +223,9 @@ static void low_level_init(struct netif *netif) p_ctrl = &os_gmac_ptr->gmac; /* Init Gmac */ - FtOsGmacInit(os_gmac_ptr, &phy); + FtOsGmacInit(os_gmac_ptr, &phy); - /* Set Receive Callback */ + /* Set Receive Callback */ FGmacRegisterEvtHandler(p_ctrl, FGMAC_RX_COMPLETE_EVT, GmacReceiveCallBack); #if LWIP_ARP || LWIP_ETHERNET @@ -574,12 +574,7 @@ static err_t low_level_output_arp_off(struct netif *netif, struct pbuf *q, const err_t errval; errval = ERR_OK; -/* USER CODE BEGIN 5 */ - -/* USER CODE END 5 */ - return errval; - } #endif /* LWIP_ARP */ @@ -688,9 +683,9 @@ sio_fd_t sio_open(u8_t devnum) sio_fd_t sd; (void)devnum; - sd = 0; // dummy code + sd = 0; - return sd; + return sd; } /** @@ -711,7 +706,7 @@ u32_t sio_read(sio_fd_t fd, u8_t *data, u32_t len) (void)data; (void)fd; - recved_bytes = 0; // dummy code + recved_bytes = 0; return recved_bytes; } diff --git a/third-party/lwip-2.1.2/ports/f_gmac/ft_os_gmac.c b/third-party/lwip-2.1.2/ports/f_gmac/ft_os_gmac.c index 5aec6de4..68b5ba5d 100644 --- a/third-party/lwip-2.1.2/ports/f_gmac/ft_os_gmac.c +++ b/third-party/lwip-2.1.2/ports/f_gmac/ft_os_gmac.c @@ -326,13 +326,13 @@ void FtOsGmacInit(FtOsGmac *os_gmac, FGmacPhy *phy_p) gmac = &os_gmac->gmac; FtOsGmacMemFree(os_gmac); - FT_ASSERTVOID(FGmacCfgInitialize(gmac, FGmacLookupConfig(GMAC_INSTANCE_0)) == FT_SUCCESS); + FT_ASSERTVOID(FGmacCfgInitialize(gmac, FGmacLookupConfig(gmac->config.instance_id)) == FT_SUCCESS); FtOsGmacMemCreate(os_gmac); /* initialize phy */ memset(phy_p, 0U, sizeof(FGmacPhy)); - FGmacPhyLookupConfig(GMAC_INSTANCE_0, phy_p); + FGmacPhyLookupConfig(gmac->config.instance_id, phy_p); FT_ASSERTVOID(FGmacPhyCfgInitialize(phy_p) == FT_SUCCESS); /* Create a binary semaphore used for informing ethernetif of frame reception */ -- Gitee From e40b05ac4f0035f669e4a8dffd754e269741aa3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=99=93=E4=B8=9C?= Date: Fri, 24 Dec 2021 02:43:42 +0000 Subject: [PATCH 14/14] adapt to the new standalone sdk --- .gitlab/README_TEMPLATE.zh-CN.md | 50 +++ .../issue_templates/ISSUE_TEMPLATE.zh-CN.md | 13 + .../PULL_REQUEST_TEMPLATE.md | 45 +++ .vscode/settings.json | 46 --- configs/d2000_aarch32_defconfig | 6 +- configs/d2000_aarch64_defconfig | 6 +- configs/ft2004_aarch32_defconfig | 6 +- configs/ft2004_aarch64_defconfig | 4 +- docs/Changlog.md | 9 + drivers/ft_os_uart.c | 125 ------- example/freertos_test/README.md | 37 ++- .../configs/d2000_aarch32_eg_configs | 135 ++++++++ .../configs/d2000_aarch64_eg_configs | 129 +++++++ .../configs/ft2004_aarch32_eg_configs | 135 ++++++++ .../configs/ft2004_aarch64_eg_configs | 129 +++++++ example/freertos_test/main.c | 6 +- example/freertos_test/sdkconfig | 24 +- example/freertos_test/sdkconfig.h | 23 +- .../configs/d2000_aarch32_eg_configs | 133 ++++++++ .../configs/d2000_aarch64_eg_configs | 127 +++++++ .../configs/ft2004_aarch32_eg_configs | 133 ++++++++ .../configs/ft2004_aarch64_eg_configs | 127 +++++++ example/function_test/main.c | 5 +- example/function_test/sdkconfig | 55 ++- example/function_test/sdkconfig.h | 56 ++-- example/function_test/src/test_uart.c | 16 +- .../configs/d2000_aarch32_eg_configs | 131 ++++++++ .../configs/d2000_aarch64_eg_configs | 125 +++++++ .../configs/ft2004_aarch32_eg_configs | 138 ++++++++ .../configs/ft2004_aarch64_eg_configs | 132 ++++++++ example/hello_world/sdkconfig | 71 ++-- example/hello_world/sdkconfig.h | 66 ++-- example/lwip_test/README.md | 36 +- .../configs/d2000_aarch32_eg_configs | 134 ++++++++ .../configs/d2000_aarch64_eg_configs | 128 +++++++ .../configs/ft2004_aarch32_eg_configs | 141 ++++++++ .../configs/ft2004_aarch64_eg_configs | 135 ++++++++ example/lwip_test/sdkconfig | 37 +-- example/lwip_test/sdkconfig.h | 34 +- example/lwip_test/test_lwip.c | 6 +- .../start_up/configs/d2000_aarch32_eg_configs | 142 ++++++++ .../start_up/configs/d2000_aarch64_eg_configs | 136 ++++++++ .../configs/ft2004_aarch32_eg_configs | 142 ++++++++ .../configs/ft2004_aarch64_eg_configs | 136 ++++++++ example/start_up/sdkconfig | 66 ++-- example/start_up/sdkconfig.h | 63 ++-- example/start_up/test_uart.c | 12 +- .../template/configs/d2000_aarch32_eg_configs | 131 ++++++++ .../template/configs/d2000_aarch64_eg_configs | 125 +++++++ .../configs/ft2004_aarch32_eg_configs | 138 ++++++++ .../configs/ft2004_aarch64_eg_configs | 132 ++++++++ example/template/sdkconfig | 69 ++-- example/template/sdkconfig.h | 66 ++-- install.py | 2 +- make/build_all.mk | 74 +++++ make/build_freertos.mk | 3 +- make/complier.mk | 7 +- make/ld/Kconfig | 85 +++-- make/ld/aarch32_ram.ld | 161 +++++---- make/ld/aarch64_ram.ld | 214 +++++++----- make/menuconfig.mk | 5 + standalone_adaptive.mk | 11 + third-party/Kconfig | 6 - .../GCC/ft_platform/aarch32/FreeRTOSConfig.h | 4 +- .../portable/GCC/ft_platform/aarch32/vector.S | 80 +++++ .../GCC/ft_platform/aarch64/FreeRTOSConfig.h | 4 + .../portable/GCC/ft_platform/aarch64/boot.S | 126 +++++++ .../portable/GCC/ft_platform/aarch64/port.c | 1 - .../GCC/ft_platform/aarch64/portASM.S | 5 +- .../GCC/ft_platform/aarch64/portAsm_debug.c | 22 ++ .../GCC/ft_platform/aarch64/vectors.S | 314 ++++++++++++++++++ .../GCC/ft_platform/aarch64/vectors_g.c | 25 ++ .../freertos/portable/freertos_configs.c | 47 ++- third-party/freertos/tasks.c | 1 - third-party/freertos/timers.c | 2 +- third-party/lwip-2.1.2/Kconfig | 2 +- .../lwip-2.1.2/ports/f_gmac/ethernetif.c | 173 +++++----- .../lwip-2.1.2/ports/f_gmac/ft_os_gmac.c | 247 ++++++++++++-- .../lwip-2.1.2/ports/f_gmac/ft_os_gmac.h | 15 +- third-party/third-party.mk | 2 +- 80 files changed, 4968 insertions(+), 922 deletions(-) create mode 100644 .gitlab/README_TEMPLATE.zh-CN.md create mode 100644 .gitlab/issue_templates/ISSUE_TEMPLATE.zh-CN.md create mode 100644 .gitlab/merge_request_templates/PULL_REQUEST_TEMPLATE.md delete mode 100644 .vscode/settings.json create mode 100644 example/freertos_test/configs/d2000_aarch32_eg_configs create mode 100644 example/freertos_test/configs/d2000_aarch64_eg_configs create mode 100644 example/freertos_test/configs/ft2004_aarch32_eg_configs create mode 100644 example/freertos_test/configs/ft2004_aarch64_eg_configs create mode 100644 example/function_test/configs/d2000_aarch32_eg_configs create mode 100644 example/function_test/configs/d2000_aarch64_eg_configs create mode 100644 example/function_test/configs/ft2004_aarch32_eg_configs create mode 100644 example/function_test/configs/ft2004_aarch64_eg_configs create mode 100644 example/hello_world/configs/d2000_aarch32_eg_configs create mode 100644 example/hello_world/configs/d2000_aarch64_eg_configs create mode 100644 example/hello_world/configs/ft2004_aarch32_eg_configs create mode 100644 example/hello_world/configs/ft2004_aarch64_eg_configs create mode 100644 example/lwip_test/configs/d2000_aarch32_eg_configs create mode 100644 example/lwip_test/configs/d2000_aarch64_eg_configs create mode 100644 example/lwip_test/configs/ft2004_aarch32_eg_configs create mode 100644 example/lwip_test/configs/ft2004_aarch64_eg_configs create mode 100644 example/start_up/configs/d2000_aarch32_eg_configs create mode 100644 example/start_up/configs/d2000_aarch64_eg_configs create mode 100644 example/start_up/configs/ft2004_aarch32_eg_configs create mode 100644 example/start_up/configs/ft2004_aarch64_eg_configs create mode 100644 example/template/configs/d2000_aarch32_eg_configs create mode 100644 example/template/configs/d2000_aarch64_eg_configs create mode 100644 example/template/configs/ft2004_aarch32_eg_configs create mode 100644 example/template/configs/ft2004_aarch64_eg_configs create mode 100644 make/build_all.mk create mode 100644 standalone_adaptive.mk create mode 100644 third-party/freertos/portable/GCC/ft_platform/aarch32/vector.S create mode 100644 third-party/freertos/portable/GCC/ft_platform/aarch64/boot.S create mode 100644 third-party/freertos/portable/GCC/ft_platform/aarch64/portAsm_debug.c create mode 100644 third-party/freertos/portable/GCC/ft_platform/aarch64/vectors.S create mode 100644 third-party/freertos/portable/GCC/ft_platform/aarch64/vectors_g.c diff --git a/.gitlab/README_TEMPLATE.zh-CN.md b/.gitlab/README_TEMPLATE.zh-CN.md new file mode 100644 index 00000000..547b7011 --- /dev/null +++ b/.gitlab/README_TEMPLATE.zh-CN.md @@ -0,0 +1,50 @@ + +# XXX + +## 1. 例程介绍 + +>介绍例程的用途,使用场景,相关基本概念,描述用户可以使用例程完成哪些工作
+ +## 2. 如何使用例程 + +>描述开发平台准备,使用例程配置,构建和下载镜像的过程
+ +### 2.1 硬件配置方法 + +>哪些硬件平台是支持的,需要哪些外设,例程与开发板哪些IO口相关等(建议附录开发板照片,展示哪些IO口被引出)
+ +### 2.2 SDK配置方法 + +>依赖哪些驱动、库和第三方组件,如何完成配置(列出需要使能的关键配置项)
+ +### 2.3 构建和下载 + +>描述构建、烧录下载镜像的过程,列出相关的命令
+ +### 2.4 输出与实验现象 + +>描述输入输出情况,列出存在哪些输出,对应的输出是什么(建议附录相关现象图片)
+ +## 3. 如何解决问题 + +>主要记录使用例程中可能会遇到的问题,给出相应的解决方案
+ +## 4. 修改历史记录 + +>记录例程的重大修改记录,标明修改发生的版本号
+ + + + diff --git a/.gitlab/issue_templates/ISSUE_TEMPLATE.zh-CN.md b/.gitlab/issue_templates/ISSUE_TEMPLATE.zh-CN.md new file mode 100644 index 00000000..f09d98dd --- /dev/null +++ b/.gitlab/issue_templates/ISSUE_TEMPLATE.zh-CN.md @@ -0,0 +1,13 @@ +### 该问题是怎么引起的? + + + +### 重现步骤 + + + +### 报错信息 + + + + diff --git a/.gitlab/merge_request_templates/PULL_REQUEST_TEMPLATE.md b/.gitlab/merge_request_templates/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..55b8b555 --- /dev/null +++ b/.gitlab/merge_request_templates/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,45 @@ + +## 拉取/合并请求描述: + +[ +这段方括号里的内容是您**必须填写并替换掉**的,否则PR不可能被合并。**方括号外面的内容不需要修改,但请仔细阅读。** +请在这里填写您的PR描述,可以包括以下之一的内容: +为什么提交这份PR;解决的问题是什么,你的解决方案是什么; +并确认并列出已经在什么情况或板卡上进行了测试; +并且附上测试结果于测试流程,如果代码存在耦合,则需要对耦合部分进行修改。 + +] + + +以下的内容不应该在提交PR时的message修改,修改下述message,PR会被直接关闭。请在提交PR后,浏览器查看PR并对以下检查项逐项check,没问题后逐条在页面上打钩。 + +### 当前拉取/合并请求的状态 + +必须选择一项 : + +- [ ] 本拉取/合并请求是一个草稿版本 +- [ ] 本拉取/合并请求是一个成熟版本 + +### 代码质量 Code Quality: + +我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following: + +- [ ] 已经仔细查看过代码改动的对比 Already check the difference between PR and old code +- [ ] 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles +- [ ] 没有垃圾代码,代码尽量精简,不包含`#if 0`代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up +- [ ] 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP +- [ ] 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky +- [ ] 本拉取/合并请求代码是高质量的 Code in this PR is of high quality +- [ ] 本拉取/合并符合[代码规范](../documentation/coding_style_cn.md) diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 51b12930..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "files.associations": { - "freertos.h": "c", - "generic_timer.h": "c", - "ft_types.h": "c", - "ft_assert.h": "c", - "queue.h": "c", - "*.tcc": "c", - "ft_debug.h": "c", - "pl011_uart.h": "c", - "gicv3.h": "c", - "interrupt.h": "c", - "task.h": "c", - "trap.h": "c", - "parameters.h": "c", - "ip4_addr.h": "c", - "gmac_hw.h": "c", - "sdkconfig.h": "c", - "timeouts.h": "c", - "fsleep.h": "c", - "freertosconfig.h": "c", - "mem.h": "c", - "ft_os_gmac.h": "c", - "gmac.h": "c", - "list.h": "c", - "netif.h": "c", - "system_error": "cpp", - "functional": "c", - "event_groups.h": "c", - "condition_variable": "c", - "future": "c", - "stats.h": "c", - "aarch32.h": "c", - "aarch64.h": "c", - "gmac_dma.h": "c", - "debug.h": "c", - "ethernetif.h": "c", - "tcpip.h": "c", - "init.h": "c", - "ethernet.h": "c", - "stdio.h": "c", - "semphr.h": "c", - "portmacro.h": "c", - "fwdt.h": "c" - } -} \ No newline at end of file diff --git a/configs/d2000_aarch32_defconfig b/configs/d2000_aarch32_defconfig index 15b70295..b20e08ce 100644 --- a/configs/d2000_aarch32_defconfig +++ b/configs/d2000_aarch32_defconfig @@ -37,7 +37,7 @@ CONFIG_TARGET_D2000=y # CONFIG_USE_SPI is not set # CONFIG_USE_QSPI is not set CONFIG_USE_GIC=y -CONFIG_EBABLE_GICV3=y +CONFIG_ENABLE_GICV3=y # CONFIG_USE_SERIAL is not set # @@ -54,7 +54,7 @@ CONFIG_USE_ETH=y # Eth Configuration # # CONFIG_ENABLE_F_XMAC is not set -CONFIG_ENABLE_F_GMAC=y +CONFIG_ENABLE_FGMAC=y # # F_GMAC Configuration @@ -109,7 +109,7 @@ CONFIG_ROM_SIZE_MB=1 CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 -CONFIG_HEAP_SIZE=0x100000 +CONFIG_HEAP_SIZE=1 CONFIG_STACK_SIZE=0x100000 # end of GNU Linker Setting # end of Building Option diff --git a/configs/d2000_aarch64_defconfig b/configs/d2000_aarch64_defconfig index 9471b8bd..a1bffdcd 100644 --- a/configs/d2000_aarch64_defconfig +++ b/configs/d2000_aarch64_defconfig @@ -38,7 +38,7 @@ CONFIG_TARGET_D2000=y # CONFIG_USE_SPI is not set # CONFIG_USE_QSPI is not set CONFIG_USE_GIC=y -CONFIG_EBABLE_GICV3=y +CONFIG_ENABLE_GICV3=y # CONFIG_USE_SERIAL is not set # @@ -55,7 +55,7 @@ CONFIG_USE_ETH=y # Eth Configuration # # CONFIG_ENABLE_F_XMAC is not set -CONFIG_ENABLE_F_GMAC=y +CONFIG_ENABLE_FGMAC=y # # F_GMAC Configuration @@ -107,7 +107,7 @@ CONFIG_ROM_SIZE_MB=1 CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 -CONFIG_HEAP_SIZE=0x100000 +CONFIG_HEAP_SIZE=1 CONFIG_STACK_TOP_ADDR=0x82000000 # end of Linker Options # end of Building Option diff --git a/configs/ft2004_aarch32_defconfig b/configs/ft2004_aarch32_defconfig index 3e86c995..ff482858 100644 --- a/configs/ft2004_aarch32_defconfig +++ b/configs/ft2004_aarch32_defconfig @@ -39,7 +39,7 @@ CONFIG_TARGET_F2000_4=y # CONFIG_USE_SPI is not set # CONFIG_USE_QSPI is not set CONFIG_USE_GIC=y -CONFIG_EBABLE_GICV3=y +CONFIG_ENABLE_GICV3=y # CONFIG_USE_SERIAL is not set # @@ -56,7 +56,7 @@ CONFIG_USE_ETH=y # Eth Configuration # # CONFIG_ENABLE_F_XMAC is not set -CONFIG_ENABLE_F_GMAC=y +CONFIG_ENABLE_FGMAC=y # # F_GMAC Configuration @@ -109,7 +109,7 @@ CONFIG_ROM_SIZE_MB=1 CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 -CONFIG_HEAP_SIZE=0x100000 +CONFIG_HEAP_SIZE=1 CONFIG_STACK_SIZE=0x100000 # end of GNU Linker Setting # end of Building Option diff --git a/configs/ft2004_aarch64_defconfig b/configs/ft2004_aarch64_defconfig index 84c05b88..9c842ff9 100644 --- a/configs/ft2004_aarch64_defconfig +++ b/configs/ft2004_aarch64_defconfig @@ -37,7 +37,7 @@ CONFIG_TARGET_F2000_4=y # CONFIG_USE_SPI is not set # CONFIG_USE_QSPI is not set CONFIG_USE_GIC=y -CONFIG_EBABLE_GICV3=y +CONFIG_ENABLE_GICV3=y # CONFIG_USE_SERIAL is not set # @@ -54,7 +54,7 @@ CONFIG_USE_ETH=y # Eth Configuration # # CONFIG_ENABLE_F_XMAC is not set -CONFIG_ENABLE_F_GMAC=y +CONFIG_ENABLE_FGMAC=y # # F_GMAC Configuration diff --git a/docs/Changlog.md b/docs/Changlog.md index 7d93c22a..70b22bbb 100644 --- a/docs/Changlog.md +++ b/docs/Changlog.md @@ -11,6 +11,15 @@ * Ver   Who        Date         Changes * ----- ------     --------    -------------------------------------- --> +# Phytium FreeRTOS SDK v0.0.6 ChangeLog + +Change Log sinc 0.0.5, 2021.12.23 + +## example + +- adapt to the new standalone sdk v0.1.15 +- reconstruct the aarch framework for freertos + # Phytium FreeRTOS SDK v0.0.5 ChangeLog Change Log sinc 0.0.4, 2021.11.2 diff --git a/drivers/ft_os_uart.c b/drivers/ft_os_uart.c index 148b5f9b..674ac4c6 100644 --- a/drivers/ft_os_uart.c +++ b/drivers/ft_os_uart.c @@ -152,93 +152,6 @@ s32 FtFreertosUartReceiveBuffer(FtFreertosUart *uart_p, u8 *buffer, u32 length, return ret; } -// s32 Ft_Os_UartReceiveBuffer(Ft_Os_Uart *OsUartPtr, u8 *buffer, u32 length, u32 *Received) -// { -// u32 GetLength; -// Ft_Uart *UartPtr; -// EventBits_t ev; -// s32 ret; -// if (NULL == OsUartPtr) -// { -// return FST_INSTANCE_NOT_FOUND; -// } - -// if (NULL == buffer) -// { -// return FST_FAILURE; -// } - -// if (NULL == Received) -// { -// return FST_FAILURE; -// } - -// if (0 == length) -// { -// *Received = 0; -// return FST_SUCCESS; -// } - -// UartPtr = &OsUartPtr->UartObj; - -// /* New transfer can be performed only after current one is finished */ -// if (pdFALSE == xSemaphoreTake(OsUartPtr->rxSemaphore, portMAX_DELAY)) -// { -// /* We could not take the semaphore, exit with 0 data received */ -// ret = FST_FAILURE; -// } - -// GetLength = FUart_Receive(UartPtr, buffer, length); -// if (GetLength > 0) -// { -// *Received = GetLength; -// ret = FST_SUCCESS; -// } -// else -// { -// u32 RegTemp; - -// RegTemp = FUart_GetInterruptMask(UartPtr); -// RegTemp |= UARTMIS_RTMIS; -// FUart_SetInterruptMask(UartPtr, RegTemp); - -// ev = xEventGroupWaitBits(OsUartPtr->rxEvent, -// RTOS_UART_COMPLETE | RTOS_UART_HARDWARE_BUFFER_OVERRUN | RTOS_UART_RECV_ERROR, -// pdTRUE, pdFALSE, portMAX_DELAY); - -// if (ev & RTOS_UART_HARDWARE_BUFFER_OVERRUN) -// { -// ret = FST_FIFO_ERROR; -// *Received = 0; -// } -// else if (ev & RTOS_UART_COMPLETE) -// { -// ret = FST_SUCCESS; -// *Received = UartPtr->ReceiveBuffer.RequestedBytes - UartPtr->ReceiveBuffer.RemainingBytes; -// } -// else if (ev & RTOS_UART_RECV_ERROR) -// { -// ret = FST_RECV_ERROR; -// *Received = 0; -// } -// else -// { -// ret = FST_INVALID_PARAM; -// *Received = 0; -// } -// } - -// /* Enable next transfer. Current one is finished */ -// if (pdFALSE == xSemaphoreGive(OsUartPtr->rxSemaphore)) -// { -// /* We could not post the semaphore, exit with error */ -// Ft_printf("FST_FAILURE xSemaphoreGive \r\n"); -// ret = FST_FAILURE; -// } - -// return ret; -// } - s32 FtFreertosUartBlcokingSend(FtFreertosUart *uart_p, u8 *buffer, u32 length) { ft_error_t ret = FT_SUCCESS; @@ -269,43 +182,5 @@ s32 FtFreertosUartBlcokingSend(FtFreertosUart *uart_p, u8 *buffer, u32 length) return ret; } -// s32 Ft_Os_UartBlockingSend(Ft_Os_Uart *OsUartPtr, u8 *buffer, u32 length) -// { -// s32 ret = FST_SUCCESS; -// Ft_Uart *UartPtr; -// EventBits_t ev; -// if (NULL == OsUartPtr) -// { -// return FST_INSTANCE_NOT_FOUND; -// } - -// if (NULL == buffer) -// { -// return FST_FAILURE; -// } - -// UartPtr = &OsUartPtr->UartObj; - -// if (pdFALSE == xSemaphoreTake(OsUartPtr->txSemaphore, portMAX_DELAY)) -// { -// return FST_FAILURE; -// } - -// FUart_Send(UartPtr, buffer, length); - -// ev = xEventGroupWaitBits(OsUartPtr->txEvent, RTOS_UART_COMPLETE, pdTRUE, pdFALSE, portMAX_DELAY); -// if (!(ev & RTOS_UART_COMPLETE)) -// { -// ret = FST_FAILURE; -// } - -// if (pdFALSE == xSemaphoreGive(OsUartPtr->txSemaphore)) -// { -// /* We could not post the semaphore, exit with error */ -// ret = FST_FAILURE; -// } - -// return ret; -// } #endif diff --git a/example/freertos_test/README.md b/example/freertos_test/README.md index 557c184e..59086c1d 100644 --- a/example/freertos_test/README.md +++ b/example/freertos_test/README.md @@ -70,20 +70,47 @@ PRIORITY_TEST----任务优先级测试 THREAD_LOCAL_TEST----线程局部存储thread local storage测试 TIMER_TEST----定时器测试 ``` + +本例子已经提供好具体的编译指令,以下进行介绍: +- make 将目录下的工程进行编译 +- make clean 将目录下的工程进行清理 +- make boot 将目录下的工程进行编译,并将生成的elf 复制到目标地址 +- make load_d2000_aarch64 将预设64bit d2000 下的配置加载至工程中 +- make load_d2000_aarch32 将预设32bit d2000 下的配置加载至工程中 +- make load_ft2004_aarch64 将预设64bit ft2004 下的配置加载至工程中 +- make load_ft2004_aarch32 将预设32bit ft2004 下的配置加载至工程中 +- make menuconfig 配置目录下的参数变量 +- make backup_kconfig 将目录下的sdkconfig 备份到./configs下 + +具体使用方法为: +- 在当前目录下 +- 执行以上指令 + ### 2.3 构建和下载 #### 2.3.1 构建过程 - 在host侧完成配置 ->配置成D2000,对于其它平台,使用对于的默认配置,如FT2000-4 `make config_ft2004_configs` +>配置成ft2004,对于其它平台,使用对于的默认配置,如D2000 `make load_d2000_aarch32` + +- 选择目标平台 +``` +make load_ft2004_aarch32 +``` + +- 选择例程需要的配置 +``` +make menuconfig +``` + +- 进行编译 ``` -$ make config_d2000_configs -$ make menuconfig +make ``` -- 在host侧完成构建 +- 将编译出的镜像放置到tftp目录下 ``` -$ make +make boot ``` #### 2.3.2 下载过程 diff --git a/example/freertos_test/configs/d2000_aarch32_eg_configs b/example/freertos_test/configs/d2000_aarch32_eg_configs new file mode 100644 index 00000000..0dfaa7ac --- /dev/null +++ b/example/freertos_test/configs/d2000_aarch32_eg_configs @@ -0,0 +1,135 @@ + +# +# Project Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +CONFIG_LWIP_POLL_TEST=y +# CONFIG_LWIP_INTRRUPT_TEST is not set +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +CONFIG_TARGET_ARMV8_AARCH32=y +# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +# CONFIG_USE_SYS_TICK is not set +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arch Configuration + +# +# Board Configuration +# +# CONFIG_TARGET_F2000_4 is not set +# CONFIG_TARGET_E2000 is not set +CONFIG_TARGET_D2000=y +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +# CONFIG_USE_SERIAL is not set +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +CONFIG_USE_WDT=y + +# +# FWDT Configuration +# +CONFIG_ENABLE_FWDT=y +# end of FWDT Configuration + +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +CONFIG_AARCH32_RAM_LD=y +# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/freertos_test/configs/d2000_aarch64_eg_configs b/example/freertos_test/configs/d2000_aarch64_eg_configs new file mode 100644 index 00000000..f83c5237 --- /dev/null +++ b/example/freertos_test/configs/d2000_aarch64_eg_configs @@ -0,0 +1,129 @@ + +# +# Project Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +CONFIG_LWIP_POLL_TEST=y +# CONFIG_LWIP_INTRRUPT_TEST is not set +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +# CONFIG_USE_SYS_TICK is not set +# end of Arch Configuration + +# +# Board Configuration +# +# CONFIG_TARGET_F2000_4 is not set +# CONFIG_TARGET_E2000 is not set +CONFIG_TARGET_D2000=y +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +# CONFIG_USE_SERIAL is not set +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +CONFIG_USE_WDT=y + +# +# FWDT Configuration +# +CONFIG_ENABLE_FWDT=y +# end of FWDT Configuration + +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x100000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/freertos_test/configs/ft2004_aarch32_eg_configs b/example/freertos_test/configs/ft2004_aarch32_eg_configs new file mode 100644 index 00000000..0f8e8d96 --- /dev/null +++ b/example/freertos_test/configs/ft2004_aarch32_eg_configs @@ -0,0 +1,135 @@ + +# +# Project Configuration +# +CONFIG_TARGET_NAME="ft2004_freertos" +CONFIG_LWIP_POLL_TEST=y +# CONFIG_LWIP_INTRRUPT_TEST is not set +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +CONFIG_TARGET_ARMV8_AARCH32=y +# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arch Configuration + +# +# Board Configuration +# +CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_E2000 is not set +# CONFIG_TARGET_D2000 is not set +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +# CONFIG_USE_SERIAL is not set +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +CONFIG_USE_WDT=y + +# +# FWDT Configuration +# +CONFIG_ENABLE_FWDT=y +# end of FWDT Configuration + +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +CONFIG_AARCH32_RAM_LD=y +# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/freertos_test/configs/ft2004_aarch64_eg_configs b/example/freertos_test/configs/ft2004_aarch64_eg_configs new file mode 100644 index 00000000..273b8742 --- /dev/null +++ b/example/freertos_test/configs/ft2004_aarch64_eg_configs @@ -0,0 +1,129 @@ + +# +# Project Configuration +# +CONFIG_TARGET_NAME="ft2004_freertos" +CONFIG_LWIP_POLL_TEST=y +# CONFIG_LWIP_INTRRUPT_TEST is not set +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +# end of Arch Configuration + +# +# Board Configuration +# +CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_E2000 is not set +# CONFIG_TARGET_D2000 is not set +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +# CONFIG_USE_SERIAL is not set +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +CONFIG_USE_WDT=y + +# +# FWDT Configuration +# +CONFIG_ENABLE_FWDT=y +# end of FWDT Configuration + +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x100000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/freertos_test/main.c b/example/freertos_test/main.c index fcde60fd..69c2be12 100644 --- a/example/freertos_test/main.c +++ b/example/freertos_test/main.c @@ -18,9 +18,7 @@ #include "task.h" #include "unity.h" -// #define EVENT_GROUPS_TEST 1 -// #define TRACE_FACILITY_TEST 1 -#if 1 + #define ISR_FLOAT_TEST 1 #define BACKPORT_TEST 1 #define DEBUG_QUEUE_REGISTER_TEST 1 @@ -41,7 +39,7 @@ #define PRIORITY_TEST 1 #define THREAD_LOCAL_TEST 1 #define TIMER_TEST 1 -#endif + #if ISR_FLOAT_TEST extern BaseType_t TestFloatIsrEntry(void); diff --git a/example/freertos_test/sdkconfig b/example/freertos_test/sdkconfig index a4853dd5..f83c5237 100644 --- a/example/freertos_test/sdkconfig +++ b/example/freertos_test/sdkconfig @@ -21,7 +21,7 @@ CONFIG_TARGET_ARMV8_AARCH64=y CONFIG_USE_CACHE=y CONFIG_USE_L3CACHE=y CONFIG_USE_MMU=y -CONFIG_USE_SYS_TICK=y +# CONFIG_USE_SYS_TICK is not set # end of Arch Configuration # @@ -38,7 +38,7 @@ CONFIG_TARGET_D2000=y # CONFIG_USE_SPI is not set # CONFIG_USE_QSPI is not set CONFIG_USE_GIC=y -CONFIG_EBABLE_GICV3=y +CONFIG_ENABLE_GICV3=y # CONFIG_USE_SERIAL is not set # CONFIG_USE_GPIO is not set # CONFIG_USE_IOMUX is not set @@ -47,15 +47,10 @@ CONFIG_USE_ETH=y # # Eth Configuration # -# CONFIG_ENABLE_F_XMAC is not set -CONFIG_ENABLE_F_GMAC=y - -# -# F_GMAC Configuration -# -CONFIG_F_GMAC_PHY_COMMON=y -# CONFIG_F_GMAC_PHY_AR803X is not set -# end of F_GMAC Configuration +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set # end of Eth Configuration # CONFIG_USE_CAN is not set @@ -73,6 +68,7 @@ CONFIG_ENABLE_FWDT=y # CONFIG_USE_DMA is not set # CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set # end of Components Configuration CONFIG_USE_G_LIBC=y @@ -87,6 +83,7 @@ CONFIG_USE_G_LIBC=y # Cross-Compiler Setting # CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 # CONFIG_USE_EXT_COMPILER is not set # end of Cross-Compiler Setting @@ -102,7 +99,6 @@ CONFIG_LOG_INFO=y # # CONFIG_AARCH32_RAM_LD is not set CONFIG_AARCH64_RAM_LD=y -# CONFIG_QEMU_AARCH32_RAM_LD is not set # CONFIG_USER_DEFINED_LD is not set CONFIG_LINK_SCRIPT_ROM=y CONFIG_ROM_START_UP_ADDR=0x80100000 @@ -110,8 +106,8 @@ CONFIG_ROM_SIZE_MB=1 CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 -CONFIG_HEAP_SIZE=0x100000 -CONFIG_STACK_TOP_ADDR=0x82000000 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x100000 # end of Linker Options # end of Building Option diff --git a/example/freertos_test/sdkconfig.h b/example/freertos_test/sdkconfig.h index 76216d09..0db78ce5 100644 --- a/example/freertos_test/sdkconfig.h +++ b/example/freertos_test/sdkconfig.h @@ -20,7 +20,7 @@ #define CONFIG_USE_CACHE #define CONFIG_USE_L3CACHE #define CONFIG_USE_MMU -#define CONFIG_USE_SYS_TICK +/* CONFIG_USE_SYS_TICK is not set */ /* end of Arch Configuration */ /* Board Configuration */ @@ -35,7 +35,7 @@ /* CONFIG_USE_SPI is not set */ /* CONFIG_USE_QSPI is not set */ #define CONFIG_USE_GIC -#define CONFIG_EBABLE_GICV3 +#define CONFIG_ENABLE_GICV3 /* CONFIG_USE_SERIAL is not set */ /* CONFIG_USE_GPIO is not set */ /* CONFIG_USE_IOMUX is not set */ @@ -43,14 +43,10 @@ /* Eth Configuration */ -/* CONFIG_ENABLE_F_XMAC is not set */ -#define CONFIG_ENABLE_F_GMAC - -/* F_GMAC Configuration */ - -#define CONFIG_F_GMAC_PHY_COMMON -/* CONFIG_F_GMAC_PHY_AR803X is not set */ -/* end of F_GMAC Configuration */ +/* CONFIG_ENABLE_FXMAC is not set */ +#define CONFIG_ENABLE_FGMAC +#define CONFIG_FGMAC_PHY_COMMON +/* CONFIG_FGMAC_PHY_AR803X is not set */ /* end of Eth Configuration */ /* CONFIG_USE_CAN is not set */ /* CONFIG_USE_I2C is not set */ @@ -65,6 +61,7 @@ /* end of FWDT Configuration */ /* CONFIG_USE_DMA is not set */ /* CONFIG_USE_NAND is not set */ +/* CONFIG_USE_RTC is not set */ /* end of Components Configuration */ #define CONFIG_USE_G_LIBC /* CONFIG_USE_NEW_LIBC is not set */ @@ -75,6 +72,7 @@ /* Cross-Compiler Setting */ #define CONFIG_COMPILER_NO_STD_STARUP +#define CONFIG_GCC_OPTIMIZE_LEVEL 0 /* CONFIG_USE_EXT_COMPILER is not set */ /* end of Cross-Compiler Setting */ /* CONFIG_LOG_VERBOS is not set */ @@ -88,7 +86,6 @@ /* CONFIG_AARCH32_RAM_LD is not set */ #define CONFIG_AARCH64_RAM_LD -/* CONFIG_QEMU_AARCH32_RAM_LD is not set */ /* CONFIG_USER_DEFINED_LD is not set */ #define CONFIG_LINK_SCRIPT_ROM #define CONFIG_ROM_START_UP_ADDR 0x80100000 @@ -96,8 +93,8 @@ #define CONFIG_LINK_SCRIPT_RAM #define CONFIG_RAM_START_UP_ADDR 0x81000000 #define CONFIG_RAM_SIZE_MB 64 -#define CONFIG_HEAP_SIZE 0x100000 -#define CONFIG_STACK_TOP_ADDR 0x82000000 +#define CONFIG_HEAP_SIZE 1 +#define CONFIG_STACK_SIZE 0x400 /* end of Linker Options */ /* end of Building Option */ diff --git a/example/function_test/configs/d2000_aarch32_eg_configs b/example/function_test/configs/d2000_aarch32_eg_configs new file mode 100644 index 00000000..474c4a22 --- /dev/null +++ b/example/function_test/configs/d2000_aarch32_eg_configs @@ -0,0 +1,133 @@ + +# +# Project Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +CONFIG_TARGET_ARMV8_AARCH32=y +# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +# CONFIG_USE_SYS_TICK is not set +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arch Configuration + +# +# Board Configuration +# +# CONFIG_TARGET_F2000_4 is not set +# CONFIG_TARGET_E2000 is not set +CONFIG_TARGET_D2000=y +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +CONFIG_AARCH32_RAM_LD=y +# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/function_test/configs/d2000_aarch64_eg_configs b/example/function_test/configs/d2000_aarch64_eg_configs new file mode 100644 index 00000000..5e3e88df --- /dev/null +++ b/example/function_test/configs/d2000_aarch64_eg_configs @@ -0,0 +1,127 @@ + +# +# Project Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +# CONFIG_USE_SYS_TICK is not set +# end of Arch Configuration + +# +# Board Configuration +# +# CONFIG_TARGET_F2000_4 is not set +# CONFIG_TARGET_E2000 is not set +CONFIG_TARGET_D2000=y +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x100000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/function_test/configs/ft2004_aarch32_eg_configs b/example/function_test/configs/ft2004_aarch32_eg_configs new file mode 100644 index 00000000..dcc38b23 --- /dev/null +++ b/example/function_test/configs/ft2004_aarch32_eg_configs @@ -0,0 +1,133 @@ + +# +# Project Configuration +# +CONFIG_TARGET_NAME="ft2004_freertos" +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +CONFIG_TARGET_ARMV8_AARCH32=y +# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arch Configuration + +# +# Board Configuration +# +CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_E2000 is not set +# CONFIG_TARGET_D2000 is not set +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +CONFIG_AARCH32_RAM_LD=y +# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/function_test/configs/ft2004_aarch64_eg_configs b/example/function_test/configs/ft2004_aarch64_eg_configs new file mode 100644 index 00000000..ffdfab41 --- /dev/null +++ b/example/function_test/configs/ft2004_aarch64_eg_configs @@ -0,0 +1,127 @@ + +# +# Project Configuration +# +CONFIG_TARGET_NAME="ft2004_freertos" +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +# end of Arch Configuration + +# +# Board Configuration +# +CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_E2000 is not set +# CONFIG_TARGET_D2000 is not set +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x100000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/function_test/main.c b/example/function_test/main.c index 82fe5292..d2bda41a 100644 --- a/example/function_test/main.c +++ b/example/function_test/main.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0. * * @Date: 2021-07-09 08:08:39 - * @LastEditTime: 2021-07-22 09:22:21 + * @LastEditTime: 2021-12-15 16:57:31 * @Description:  This files is for * * @Modify History: @@ -20,7 +20,7 @@ extern BaseType_t TestMsgQueueEntry(); int main() { BaseType_t xReturn = pdPASS; - + printf("main is start \r\n") ; xReturn = TestCpuStatsEntry(); if (pdPASS != xReturn) { @@ -33,6 +33,7 @@ int main() goto FAIL_EXIT; } + printf("vTaskStartScheduler \r\n") ; vTaskStartScheduler(); /* 启动任务,开启调度 */ while (1); /* 正常不会执行到这里 */ diff --git a/example/function_test/sdkconfig b/example/function_test/sdkconfig index bf666aa6..5e3e88df 100644 --- a/example/function_test/sdkconfig +++ b/example/function_test/sdkconfig @@ -2,9 +2,7 @@ # # Project Configuration # -CONFIG_TARGET_NAME="ft2004_freertos" -#CONFIG_LWIP_POLL_TEST=y -# CONFIG_LWIP_INTRRUPT_TEST is not set +CONFIG_TARGET_NAME="d2000_freertos" # end of Project Configuration # @@ -15,22 +13,21 @@ CONFIG_USE_FREERTOS=y # # Arch Configuration # -CONFIG_TARGET_ARMV8_AARCH32=y -# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y # CONFIG_TARGET_ARMV7 is not set CONFIG_USE_CACHE=y CONFIG_USE_L3CACHE=y CONFIG_USE_MMU=y -CONFIG_USE_SYS_TICK=y -CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# CONFIG_USE_SYS_TICK is not set # end of Arch Configuration # # Board Configuration # -CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_F2000_4 is not set # CONFIG_TARGET_E2000 is not set -# CONFIG_TARGET_D2000 is not set +CONFIG_TARGET_D2000=y # end of Board Configuration # @@ -39,7 +36,7 @@ CONFIG_TARGET_F2000_4=y # CONFIG_USE_SPI is not set # CONFIG_USE_QSPI is not set CONFIG_USE_GIC=y -CONFIG_EBABLE_GICV3=y +CONFIG_ENABLE_GICV3=y CONFIG_USE_SERIAL=y # @@ -55,15 +52,10 @@ CONFIG_USE_ETH=y # # Eth Configuration # -# CONFIG_ENABLE_F_XMAC is not set -CONFIG_ENABLE_F_GMAC=y - -# -# F_GMAC Configuration -# -# CONFIG_F_GMAC_PHY_COMMON is not set -CONFIG_F_GMAC_PHY_AR803X=y -# end of F_GMAC Configuration +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set # end of Eth Configuration # CONFIG_USE_CAN is not set @@ -73,20 +65,23 @@ CONFIG_F_GMAC_PHY_AR803X=y # CONFIG_USE_PCIE is not set # CONFIG_USE_WDT is not set # CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set # end of Components Configuration -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set # end of Standalone Setting # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y # # Cross-Compiler Setting # CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 # CONFIG_USE_EXT_COMPILER is not set # end of Cross-Compiler Setting @@ -98,10 +93,10 @@ CONFIG_LOG_INFO=y # CONFIG_LOG_NONE is not set # -# GNU Linker Setting +# Linker Options # -CONFIG_AARCH32_RAM_LD=y -# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y # CONFIG_USER_DEFINED_LD is not set CONFIG_LINK_SCRIPT_ROM=y CONFIG_ROM_START_UP_ADDR=0x80100000 @@ -109,9 +104,9 @@ CONFIG_ROM_SIZE_MB=1 CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 -CONFIG_HEAP_SIZE=0x100000 +CONFIG_HEAP_SIZE=1 CONFIG_STACK_SIZE=0x100000 -# end of GNU Linker Setting +# end of Linker Options # end of Building Option # @@ -128,11 +123,5 @@ CONFIG_FREERTOS_USE_UART=y # # FreeRTOS Setting # -#CONFIG_USE_LWIP=y - -# -# LWIP Configuration -# -#CONFIG_LWIP_F_GMAC=y -# end of LWIP Configuration +# CONFIG_USE_LWIP is not set # end of FreeRTOS Setting diff --git a/example/function_test/sdkconfig.h b/example/function_test/sdkconfig.h index 179f0cae..b789a4f8 100644 --- a/example/function_test/sdkconfig.h +++ b/example/function_test/sdkconfig.h @@ -3,9 +3,7 @@ /* Project Configuration */ -#define CONFIG_TARGET_NAME "ft2004_freertos" -/*CONFIG_LWIP_POLL_TEST=y */ -/* CONFIG_LWIP_INTRRUPT_TEST is not set */ +#define CONFIG_TARGET_NAME "d2000_freertos" /* end of Project Configuration */ /* Standalone Setting */ @@ -14,21 +12,20 @@ /* Arch Configuration */ -#define CONFIG_TARGET_ARMV8_AARCH32 -/* CONFIG_TARGET_ARMV8_AARCH64 is not set */ +/* CONFIG_TARGET_ARMV8_AARCH32 is not set */ +#define CONFIG_TARGET_ARMV8_AARCH64 /* CONFIG_TARGET_ARMV7 is not set */ #define CONFIG_USE_CACHE #define CONFIG_USE_L3CACHE #define CONFIG_USE_MMU -#define CONFIG_USE_SYS_TICK -#define CONFIG_USE_AARCH64_L1_TO_AARCH32 +/* CONFIG_USE_SYS_TICK is not set */ /* end of Arch Configuration */ /* Board Configuration */ -#define CONFIG_TARGET_F2000_4 +/* CONFIG_TARGET_F2000_4 is not set */ /* CONFIG_TARGET_E2000 is not set */ -/* CONFIG_TARGET_D2000 is not set */ +#define CONFIG_TARGET_D2000 /* end of Board Configuration */ /* Components Configuration */ @@ -36,7 +33,7 @@ /* CONFIG_USE_SPI is not set */ /* CONFIG_USE_QSPI is not set */ #define CONFIG_USE_GIC -#define CONFIG_EBABLE_GICV3 +#define CONFIG_ENABLE_GICV3 #define CONFIG_USE_SERIAL /* Usart Configuration */ @@ -49,14 +46,10 @@ /* Eth Configuration */ -/* CONFIG_ENABLE_F_XMAC is not set */ -#define CONFIG_ENABLE_F_GMAC - -/* F_GMAC Configuration */ - -/* CONFIG_F_GMAC_PHY_COMMON is not set */ -#define CONFIG_F_GMAC_PHY_AR803X -/* end of F_GMAC Configuration */ +/* CONFIG_ENABLE_FXMAC is not set */ +#define CONFIG_ENABLE_FGMAC +#define CONFIG_FGMAC_PHY_COMMON +/* CONFIG_FGMAC_PHY_AR803X is not set */ /* end of Eth Configuration */ /* CONFIG_USE_CAN is not set */ /* CONFIG_USE_I2C is not set */ @@ -65,17 +58,19 @@ /* CONFIG_USE_PCIE is not set */ /* CONFIG_USE_WDT is not set */ /* CONFIG_USE_DMA is not set */ +/* CONFIG_USE_NAND is not set */ +/* CONFIG_USE_RTC is not set */ /* end of Components Configuration */ -#define CONFIG_USE_LIBC +#define CONFIG_USE_G_LIBC +/* CONFIG_USE_NEW_LIBC is not set */ /* end of Standalone Setting */ /* Building Option */ -#define CONFIG_ENVI_UBUNTU_20_04 - /* Cross-Compiler Setting */ #define CONFIG_COMPILER_NO_STD_STARUP +#define CONFIG_GCC_OPTIMIZE_LEVEL 0 /* CONFIG_USE_EXT_COMPILER is not set */ /* end of Cross-Compiler Setting */ /* CONFIG_LOG_VERBOS is not set */ @@ -85,10 +80,10 @@ /* CONFIG_LOG_ERROR is not set */ /* CONFIG_LOG_NONE is not set */ -/* GNU Linker Setting */ +/* Linker Options */ -#define CONFIG_AARCH32_RAM_LD -/* CONFIG_AARCH64_RAM_LD is not set */ +/* CONFIG_AARCH32_RAM_LD is not set */ +#define CONFIG_AARCH64_RAM_LD /* CONFIG_USER_DEFINED_LD is not set */ #define CONFIG_LINK_SCRIPT_ROM #define CONFIG_ROM_START_UP_ADDR 0x80100000 @@ -96,9 +91,9 @@ #define CONFIG_LINK_SCRIPT_RAM #define CONFIG_RAM_START_UP_ADDR 0x81000000 #define CONFIG_RAM_SIZE_MB 64 -#define CONFIG_HEAP_SIZE 0x100000 -#define CONFIG_STACK_SIZE 0x100000 -/* end of GNU Linker Setting */ +#define CONFIG_HEAP_SIZE 1 +#define CONFIG_STACK_SIZE 0x400 +/* end of Linker Options */ /* end of Building Option */ /* Component Configuration */ @@ -111,12 +106,7 @@ /* FreeRTOS Setting */ -/*CONFIG_USE_LWIP=y */ - -/* LWIP Configuration */ - -/*CONFIG_LWIP_F_GMAC=y */ -/* end of LWIP Configuration */ +/* CONFIG_USE_LWIP is not set */ /* end of FreeRTOS Setting */ #endif diff --git a/example/function_test/src/test_uart.c b/example/function_test/src/test_uart.c index 5fd9715f..d1ab31d9 100644 --- a/example/function_test/src/test_uart.c +++ b/example/function_test/src/test_uart.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0. * * @Date: 2021-07-05 13:48:25 - * @LastEditTime: 2021-07-22 09:48:23 + * @LastEditTime: 2021-12-15 15:58:22 * @Description:  This files is for * * @Modify History: @@ -13,21 +13,21 @@ */ #include #include "ft_types.h" -#include "pl011_uart.h" +#include "fpl011.h" #include "gicv3.h" #include "interrupt.h" -static Pl011 pl011_obj; +static FPl011 pl011_obj; void Uart1Init(void) { - Pl011Config config = *Pl011LookupConfig(1); - printf("config addr: 0x%x \r\n", config.base_address); - Pl011CfgInitialize(&pl011_obj, &config); - Pl011SetOptions(&pl011_obj, FUART_OPTION_UARTEN | FUART_OPTION_RXEN | FUART_OPTION_TXEN | FUART_OPTION_FIFOEN); + FPl011Config *config = (FPl011Config *)FPl011LookupConfig(1); + printf("config addr: 0x%x \r\n", config->base_address); + FPl011CfgInitialize(&pl011_obj, config); + FPl011SetOptions(&pl011_obj, FPL011_OPTION_UARTEN | FPL011_OPTION_RXEN | FPL011_OPTION_TXEN | FPL011_OPTION_FIFOEN); } u8 BlockReceive() { - return Pl011BlockReceive(&pl011_obj); + return FPl011BlockReceive(&pl011_obj); } \ No newline at end of file diff --git a/example/hello_world/configs/d2000_aarch32_eg_configs b/example/hello_world/configs/d2000_aarch32_eg_configs new file mode 100644 index 00000000..e5097300 --- /dev/null +++ b/example/hello_world/configs/d2000_aarch32_eg_configs @@ -0,0 +1,131 @@ + +# +# Project Configuration +# + +# +# FT2000-4 AARCH32 FreeRTOS Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +# end of FT2000-4 AARCH32 FreeRTOS Configuration +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +CONFIG_TARGET_ARMV8_AARCH32=y +# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +# CONFIG_USE_SYS_TICK is not set +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arch Configuration + +# +# Board Configuration +# +# CONFIG_TARGET_F2000_4 is not set +# CONFIG_TARGET_E2000 is not set +CONFIG_TARGET_D2000=y +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +# CONFIG_USE_SERIAL is not set +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +CONFIG_AARCH32_RAM_LD=y +# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/hello_world/configs/d2000_aarch64_eg_configs b/example/hello_world/configs/d2000_aarch64_eg_configs new file mode 100644 index 00000000..49b6b8cf --- /dev/null +++ b/example/hello_world/configs/d2000_aarch64_eg_configs @@ -0,0 +1,125 @@ + +# +# Project Configuration +# + +# +# FT2000-4 AARCH32 FreeRTOS Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +# end of FT2000-4 AARCH32 FreeRTOS Configuration +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +# CONFIG_USE_SYS_TICK is not set +# end of Arch Configuration + +# +# Board Configuration +# +# CONFIG_TARGET_F2000_4 is not set +# CONFIG_TARGET_E2000 is not set +CONFIG_TARGET_D2000=y +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +# CONFIG_USE_SERIAL is not set +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x100000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/hello_world/configs/ft2004_aarch32_eg_configs b/example/hello_world/configs/ft2004_aarch32_eg_configs new file mode 100644 index 00000000..e66146c7 --- /dev/null +++ b/example/hello_world/configs/ft2004_aarch32_eg_configs @@ -0,0 +1,138 @@ + +# +# Project Configuration +# + +# +# FT2000-4 AARCH32 FreeRTOS Configuration +# +CONFIG_TARGET_NAME="ft2004_freertos" +# end of FT2000-4 AARCH32 FreeRTOS Configuration +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +CONFIG_TARGET_ARMV8_AARCH32=y +# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arch Configuration + +# +# Board Configuration +# +CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_E2000 is not set +# CONFIG_TARGET_D2000 is not set +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +CONFIG_AARCH32_RAM_LD=y +# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/hello_world/configs/ft2004_aarch64_eg_configs b/example/hello_world/configs/ft2004_aarch64_eg_configs new file mode 100644 index 00000000..827547a4 --- /dev/null +++ b/example/hello_world/configs/ft2004_aarch64_eg_configs @@ -0,0 +1,132 @@ + +# +# Project Configuration +# + +# +# FT2000-4 AARCH32 FreeRTOS Configuration +# +CONFIG_TARGET_NAME="ft2004_freertos" +# end of FT2000-4 AARCH32 FreeRTOS Configuration +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +# end of Arch Configuration + +# +# Board Configuration +# +CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_E2000 is not set +# CONFIG_TARGET_D2000 is not set +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x100000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/hello_world/sdkconfig b/example/hello_world/sdkconfig index bf666aa6..8180c819 100644 --- a/example/hello_world/sdkconfig +++ b/example/hello_world/sdkconfig @@ -2,9 +2,12 @@ # # Project Configuration # -CONFIG_TARGET_NAME="ft2004_freertos" -#CONFIG_LWIP_POLL_TEST=y -# CONFIG_LWIP_INTRRUPT_TEST is not set + +# +# FT2000-4 AARCH32 FreeRTOS Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +# end of FT2000-4 AARCH32 FreeRTOS Configuration # end of Project Configuration # @@ -15,22 +18,21 @@ CONFIG_USE_FREERTOS=y # # Arch Configuration # -CONFIG_TARGET_ARMV8_AARCH32=y -# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y # CONFIG_TARGET_ARMV7 is not set CONFIG_USE_CACHE=y CONFIG_USE_L3CACHE=y CONFIG_USE_MMU=y -CONFIG_USE_SYS_TICK=y -CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# CONFIG_USE_SYS_TICK is not set # end of Arch Configuration # # Board Configuration # -CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_F2000_4 is not set # CONFIG_TARGET_E2000 is not set -# CONFIG_TARGET_D2000 is not set +CONFIG_TARGET_D2000=y # end of Board Configuration # @@ -39,15 +41,8 @@ CONFIG_TARGET_F2000_4=y # CONFIG_USE_SPI is not set # CONFIG_USE_QSPI is not set CONFIG_USE_GIC=y -CONFIG_EBABLE_GICV3=y -CONFIG_USE_SERIAL=y - -# -# Usart Configuration -# -CONFIG_ENABLE_Pl011_UART=y -# end of Usart Configuration - +CONFIG_ENABLE_GICV3=y +# CONFIG_USE_SERIAL is not set # CONFIG_USE_GPIO is not set # CONFIG_USE_IOMUX is not set CONFIG_USE_ETH=y @@ -55,15 +50,10 @@ CONFIG_USE_ETH=y # # Eth Configuration # -# CONFIG_ENABLE_F_XMAC is not set -CONFIG_ENABLE_F_GMAC=y - -# -# F_GMAC Configuration -# -# CONFIG_F_GMAC_PHY_COMMON is not set -CONFIG_F_GMAC_PHY_AR803X=y -# end of F_GMAC Configuration +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set # end of Eth Configuration # CONFIG_USE_CAN is not set @@ -73,20 +63,23 @@ CONFIG_F_GMAC_PHY_AR803X=y # CONFIG_USE_PCIE is not set # CONFIG_USE_WDT is not set # CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set # end of Components Configuration -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set # end of Standalone Setting # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y # # Cross-Compiler Setting # CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 # CONFIG_USE_EXT_COMPILER is not set # end of Cross-Compiler Setting @@ -98,10 +91,10 @@ CONFIG_LOG_INFO=y # CONFIG_LOG_NONE is not set # -# GNU Linker Setting +# Linker Options # -CONFIG_AARCH32_RAM_LD=y -# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y # CONFIG_USER_DEFINED_LD is not set CONFIG_LINK_SCRIPT_ROM=y CONFIG_ROM_START_UP_ADDR=0x80100000 @@ -109,9 +102,9 @@ CONFIG_ROM_SIZE_MB=1 CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 -CONFIG_HEAP_SIZE=0x100000 -CONFIG_STACK_SIZE=0x100000 -# end of GNU Linker Setting +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 +# end of Linker Options # end of Building Option # @@ -128,11 +121,5 @@ CONFIG_FREERTOS_USE_UART=y # # FreeRTOS Setting # -#CONFIG_USE_LWIP=y - -# -# LWIP Configuration -# -#CONFIG_LWIP_F_GMAC=y -# end of LWIP Configuration +# CONFIG_USE_LWIP is not set # end of FreeRTOS Setting diff --git a/example/hello_world/sdkconfig.h b/example/hello_world/sdkconfig.h index 179f0cae..42217ca2 100644 --- a/example/hello_world/sdkconfig.h +++ b/example/hello_world/sdkconfig.h @@ -3,9 +3,10 @@ /* Project Configuration */ -#define CONFIG_TARGET_NAME "ft2004_freertos" -/*CONFIG_LWIP_POLL_TEST=y */ -/* CONFIG_LWIP_INTRRUPT_TEST is not set */ +/* FT2000-4 AARCH32 FreeRTOS Configuration */ + +#define CONFIG_TARGET_NAME "d2000_freertos" +/* end of FT2000-4 AARCH32 FreeRTOS Configuration */ /* end of Project Configuration */ /* Standalone Setting */ @@ -14,21 +15,20 @@ /* Arch Configuration */ -#define CONFIG_TARGET_ARMV8_AARCH32 -/* CONFIG_TARGET_ARMV8_AARCH64 is not set */ +/* CONFIG_TARGET_ARMV8_AARCH32 is not set */ +#define CONFIG_TARGET_ARMV8_AARCH64 /* CONFIG_TARGET_ARMV7 is not set */ #define CONFIG_USE_CACHE #define CONFIG_USE_L3CACHE #define CONFIG_USE_MMU -#define CONFIG_USE_SYS_TICK -#define CONFIG_USE_AARCH64_L1_TO_AARCH32 +/* CONFIG_USE_SYS_TICK is not set */ /* end of Arch Configuration */ /* Board Configuration */ -#define CONFIG_TARGET_F2000_4 +/* CONFIG_TARGET_F2000_4 is not set */ /* CONFIG_TARGET_E2000 is not set */ -/* CONFIG_TARGET_D2000 is not set */ +#define CONFIG_TARGET_D2000 /* end of Board Configuration */ /* Components Configuration */ @@ -36,27 +36,18 @@ /* CONFIG_USE_SPI is not set */ /* CONFIG_USE_QSPI is not set */ #define CONFIG_USE_GIC -#define CONFIG_EBABLE_GICV3 -#define CONFIG_USE_SERIAL - -/* Usart Configuration */ - -#define CONFIG_ENABLE_Pl011_UART -/* end of Usart Configuration */ +#define CONFIG_ENABLE_GICV3 +/* CONFIG_USE_SERIAL is not set */ /* CONFIG_USE_GPIO is not set */ /* CONFIG_USE_IOMUX is not set */ #define CONFIG_USE_ETH /* Eth Configuration */ -/* CONFIG_ENABLE_F_XMAC is not set */ -#define CONFIG_ENABLE_F_GMAC - -/* F_GMAC Configuration */ - -/* CONFIG_F_GMAC_PHY_COMMON is not set */ -#define CONFIG_F_GMAC_PHY_AR803X -/* end of F_GMAC Configuration */ +/* CONFIG_ENABLE_FXMAC is not set */ +#define CONFIG_ENABLE_FGMAC +#define CONFIG_FGMAC_PHY_COMMON +/* CONFIG_FGMAC_PHY_AR803X is not set */ /* end of Eth Configuration */ /* CONFIG_USE_CAN is not set */ /* CONFIG_USE_I2C is not set */ @@ -65,17 +56,19 @@ /* CONFIG_USE_PCIE is not set */ /* CONFIG_USE_WDT is not set */ /* CONFIG_USE_DMA is not set */ +/* CONFIG_USE_NAND is not set */ +/* CONFIG_USE_RTC is not set */ /* end of Components Configuration */ -#define CONFIG_USE_LIBC +#define CONFIG_USE_G_LIBC +/* CONFIG_USE_NEW_LIBC is not set */ /* end of Standalone Setting */ /* Building Option */ -#define CONFIG_ENVI_UBUNTU_20_04 - /* Cross-Compiler Setting */ #define CONFIG_COMPILER_NO_STD_STARUP +#define CONFIG_GCC_OPTIMIZE_LEVEL 0 /* CONFIG_USE_EXT_COMPILER is not set */ /* end of Cross-Compiler Setting */ /* CONFIG_LOG_VERBOS is not set */ @@ -85,10 +78,10 @@ /* CONFIG_LOG_ERROR is not set */ /* CONFIG_LOG_NONE is not set */ -/* GNU Linker Setting */ +/* Linker Options */ -#define CONFIG_AARCH32_RAM_LD -/* CONFIG_AARCH64_RAM_LD is not set */ +/* CONFIG_AARCH32_RAM_LD is not set */ +#define CONFIG_AARCH64_RAM_LD /* CONFIG_USER_DEFINED_LD is not set */ #define CONFIG_LINK_SCRIPT_ROM #define CONFIG_ROM_START_UP_ADDR 0x80100000 @@ -96,9 +89,9 @@ #define CONFIG_LINK_SCRIPT_RAM #define CONFIG_RAM_START_UP_ADDR 0x81000000 #define CONFIG_RAM_SIZE_MB 64 -#define CONFIG_HEAP_SIZE 0x100000 -#define CONFIG_STACK_SIZE 0x100000 -/* end of GNU Linker Setting */ +#define CONFIG_HEAP_SIZE 1 +#define CONFIG_STACK_SIZE 0x400 +/* end of Linker Options */ /* end of Building Option */ /* Component Configuration */ @@ -111,12 +104,7 @@ /* FreeRTOS Setting */ -/*CONFIG_USE_LWIP=y */ - -/* LWIP Configuration */ - -/*CONFIG_LWIP_F_GMAC=y */ -/* end of LWIP Configuration */ +/* CONFIG_USE_LWIP is not set */ /* end of FreeRTOS Setting */ #endif diff --git a/example/lwip_test/README.md b/example/lwip_test/README.md index 745924a9..8705d69b 100644 --- a/example/lwip_test/README.md +++ b/example/lwip_test/README.md @@ -46,20 +46,46 @@ - Use LWIP +本例子已经提供好具体的编译指令,以下进行介绍: +- make 将目录下的工程进行编译 +- make clean 将目录下的工程进行清理 +- make boot 将目录下的工程进行编译,并将生成的elf 复制到目标地址 +- make load_d2000_aarch64 将预设64bit d2000 下的配置加载至工程中 +- make load_d2000_aarch32 将预设32bit d2000 下的配置加载至工程中 +- make load_ft2004_aarch64 将预设64bit ft2004 下的配置加载至工程中 +- make load_ft2004_aarch32 将预设32bit ft2004 下的配置加载至工程中 +- make menuconfig 配置目录下的参数变量 +- make backup_kconfig 将目录下的sdkconfig 备份到./configs下 + +具体使用方法为: +- 在当前目录下 +- 执行以上指令 + ### 2.3 构建和下载 #### 2.3.1 构建过程 - 在host侧完成配置 ->配置成D2000,对于其它平台,使用对于的默认配置,如FT2000-4 `make config_ft2004_configs` +>配置成ft2004,对于其它平台,使用对于的默认配置,如D2000 `make load_d2000_aarch32` + +- 选择目标平台 +``` +make load_ft2004_aarch32 +``` + +- 选择例程需要的配置 +``` +make menuconfig +``` + +- 进行编译 ``` -$ make config_d2000_configs -$ make menuconfig +make ``` -- 在host侧完成构建 +- 将编译出的镜像放置到tftp目录下 ``` -$ make +make boot ``` #### 2.3.2 下载过程 diff --git a/example/lwip_test/configs/d2000_aarch32_eg_configs b/example/lwip_test/configs/d2000_aarch32_eg_configs new file mode 100644 index 00000000..66efcb4e --- /dev/null +++ b/example/lwip_test/configs/d2000_aarch32_eg_configs @@ -0,0 +1,134 @@ + +# +# Project Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +CONFIG_LWIP_POLL_TEST=y +# CONFIG_LWIP_INTRRUPT_TEST is not set +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +CONFIG_TARGET_ARMV8_AARCH32=y +# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arch Configuration + +# +# Board Configuration +# +# CONFIG_TARGET_F2000_4 is not set +# CONFIG_TARGET_E2000 is not set +CONFIG_TARGET_D2000=y +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +# CONFIG_USE_SERIAL is not set +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +CONFIG_AARCH32_RAM_LD=y +# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +CONFIG_USE_LWIP=y + +# +# LWIP Configuration +# +CONFIG_LWIP_F_GMAC=y +# end of LWIP Configuration +# end of FreeRTOS Setting diff --git a/example/lwip_test/configs/d2000_aarch64_eg_configs b/example/lwip_test/configs/d2000_aarch64_eg_configs new file mode 100644 index 00000000..2f0570a8 --- /dev/null +++ b/example/lwip_test/configs/d2000_aarch64_eg_configs @@ -0,0 +1,128 @@ + +# +# Project Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +CONFIG_LWIP_POLL_TEST=y +# CONFIG_LWIP_INTRRUPT_TEST is not set +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +# end of Arch Configuration + +# +# Board Configuration +# +# CONFIG_TARGET_F2000_4 is not set +# CONFIG_TARGET_E2000 is not set +CONFIG_TARGET_D2000=y +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +# CONFIG_USE_SERIAL is not set +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x100000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +CONFIG_USE_LWIP=y + +# +# LWIP Configuration +# +CONFIG_LWIP_F_GMAC=y +# end of LWIP Configuration +# end of FreeRTOS Setting diff --git a/example/lwip_test/configs/ft2004_aarch32_eg_configs b/example/lwip_test/configs/ft2004_aarch32_eg_configs new file mode 100644 index 00000000..a7827f82 --- /dev/null +++ b/example/lwip_test/configs/ft2004_aarch32_eg_configs @@ -0,0 +1,141 @@ + +# +# Project Configuration +# +CONFIG_TARGET_NAME="ft2004_freertos" +CONFIG_LWIP_POLL_TEST=y +# CONFIG_LWIP_INTRRUPT_TEST is not set +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +CONFIG_TARGET_ARMV8_AARCH32=y +# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arch Configuration + +# +# Board Configuration +# +CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_E2000 is not set +# CONFIG_TARGET_D2000 is not set +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +# CONFIG_LOG_INFO is not set +CONFIG_LOG_WARN=y +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +CONFIG_AARCH32_RAM_LD=y +# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +CONFIG_USE_LWIP=y + +# +# LWIP Configuration +# +CONFIG_LWIP_F_GMAC=y +# end of LWIP Configuration +# end of FreeRTOS Setting diff --git a/example/lwip_test/configs/ft2004_aarch64_eg_configs b/example/lwip_test/configs/ft2004_aarch64_eg_configs new file mode 100644 index 00000000..02db22b6 --- /dev/null +++ b/example/lwip_test/configs/ft2004_aarch64_eg_configs @@ -0,0 +1,135 @@ + +# +# Project Configuration +# +CONFIG_TARGET_NAME="ft2004_freertos" +CONFIG_LWIP_POLL_TEST=y +# CONFIG_LWIP_INTRRUPT_TEST is not set +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +# end of Arch Configuration + +# +# Board Configuration +# +CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_E2000 is not set +# CONFIG_TARGET_D2000 is not set +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +# CONFIG_LOG_INFO is not set +CONFIG_LOG_WARN=y +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x100000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +CONFIG_USE_LWIP=y + +# +# LWIP Configuration +# +CONFIG_LWIP_F_GMAC=y +# end of LWIP Configuration +# end of FreeRTOS Setting diff --git a/example/lwip_test/sdkconfig b/example/lwip_test/sdkconfig index fdd0967c..2f0570a8 100644 --- a/example/lwip_test/sdkconfig +++ b/example/lwip_test/sdkconfig @@ -2,7 +2,7 @@ # # Project Configuration # -CONFIG_TARGET_NAME="ft2004_freertos" +CONFIG_TARGET_NAME="d2000_freertos" CONFIG_LWIP_POLL_TEST=y # CONFIG_LWIP_INTRRUPT_TEST is not set # end of Project Configuration @@ -27,9 +27,9 @@ CONFIG_USE_SYS_TICK=y # # Board Configuration # -CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_F2000_4 is not set # CONFIG_TARGET_E2000 is not set -# CONFIG_TARGET_D2000 is not set +CONFIG_TARGET_D2000=y # end of Board Configuration # @@ -38,15 +38,8 @@ CONFIG_TARGET_F2000_4=y # CONFIG_USE_SPI is not set # CONFIG_USE_QSPI is not set CONFIG_USE_GIC=y -CONFIG_EBABLE_GICV3=y -CONFIG_USE_SERIAL=y - -# -# Usart Configuration -# -CONFIG_ENABLE_Pl011_UART=y -# end of Usart Configuration - +CONFIG_ENABLE_GICV3=y +# CONFIG_USE_SERIAL is not set # CONFIG_USE_GPIO is not set # CONFIG_USE_IOMUX is not set CONFIG_USE_ETH=y @@ -54,15 +47,10 @@ CONFIG_USE_ETH=y # # Eth Configuration # -# CONFIG_ENABLE_F_XMAC is not set -CONFIG_ENABLE_F_GMAC=y - -# -# F_GMAC Configuration -# -# CONFIG_F_GMAC_PHY_COMMON is not set -CONFIG_F_GMAC_PHY_AR803X=y -# end of F_GMAC Configuration +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set # end of Eth Configuration # CONFIG_USE_CAN is not set @@ -73,6 +61,7 @@ CONFIG_F_GMAC_PHY_AR803X=y # CONFIG_USE_WDT is not set # CONFIG_USE_DMA is not set # CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set # end of Components Configuration CONFIG_USE_G_LIBC=y @@ -87,6 +76,7 @@ CONFIG_USE_G_LIBC=y # Cross-Compiler Setting # CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 # CONFIG_USE_EXT_COMPILER is not set # end of Cross-Compiler Setting @@ -102,7 +92,6 @@ CONFIG_LOG_INFO=y # # CONFIG_AARCH32_RAM_LD is not set CONFIG_AARCH64_RAM_LD=y -# CONFIG_QEMU_AARCH32_RAM_LD is not set # CONFIG_USER_DEFINED_LD is not set CONFIG_LINK_SCRIPT_ROM=y CONFIG_ROM_START_UP_ADDR=0x80100000 @@ -110,8 +99,8 @@ CONFIG_ROM_SIZE_MB=1 CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 -CONFIG_HEAP_SIZE=0x100000 -CONFIG_STACK_TOP_ADDR=0x82000000 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x100000 # end of Linker Options # end of Building Option diff --git a/example/lwip_test/sdkconfig.h b/example/lwip_test/sdkconfig.h index df7a5732..31ff1a56 100644 --- a/example/lwip_test/sdkconfig.h +++ b/example/lwip_test/sdkconfig.h @@ -3,7 +3,7 @@ /* Project Configuration */ -#define CONFIG_TARGET_NAME "ft2004_freertos" +#define CONFIG_TARGET_NAME "d2000_freertos" #define CONFIG_LWIP_POLL_TEST /* CONFIG_LWIP_INTRRUPT_TEST is not set */ /* end of Project Configuration */ @@ -25,9 +25,9 @@ /* Board Configuration */ -#define CONFIG_TARGET_F2000_4 +/* CONFIG_TARGET_F2000_4 is not set */ /* CONFIG_TARGET_E2000 is not set */ -/* CONFIG_TARGET_D2000 is not set */ +#define CONFIG_TARGET_D2000 /* end of Board Configuration */ /* Components Configuration */ @@ -35,27 +35,18 @@ /* CONFIG_USE_SPI is not set */ /* CONFIG_USE_QSPI is not set */ #define CONFIG_USE_GIC -#define CONFIG_EBABLE_GICV3 -#define CONFIG_USE_SERIAL - -/* Usart Configuration */ - -#define CONFIG_ENABLE_Pl011_UART -/* end of Usart Configuration */ +#define CONFIG_ENABLE_GICV3 +/* CONFIG_USE_SERIAL is not set */ /* CONFIG_USE_GPIO is not set */ /* CONFIG_USE_IOMUX is not set */ #define CONFIG_USE_ETH /* Eth Configuration */ -/* CONFIG_ENABLE_F_XMAC is not set */ -#define CONFIG_ENABLE_F_GMAC - -/* F_GMAC Configuration */ - -/* CONFIG_F_GMAC_PHY_COMMON is not set */ -#define CONFIG_F_GMAC_PHY_AR803X -/* end of F_GMAC Configuration */ +/* CONFIG_ENABLE_FXMAC is not set */ +#define CONFIG_ENABLE_FGMAC +#define CONFIG_FGMAC_PHY_COMMON +/* CONFIG_FGMAC_PHY_AR803X is not set */ /* end of Eth Configuration */ /* CONFIG_USE_CAN is not set */ /* CONFIG_USE_I2C is not set */ @@ -65,6 +56,7 @@ /* CONFIG_USE_WDT is not set */ /* CONFIG_USE_DMA is not set */ /* CONFIG_USE_NAND is not set */ +/* CONFIG_USE_RTC is not set */ /* end of Components Configuration */ #define CONFIG_USE_G_LIBC /* CONFIG_USE_NEW_LIBC is not set */ @@ -75,6 +67,7 @@ /* Cross-Compiler Setting */ #define CONFIG_COMPILER_NO_STD_STARUP +#define CONFIG_GCC_OPTIMIZE_LEVEL 0 /* CONFIG_USE_EXT_COMPILER is not set */ /* end of Cross-Compiler Setting */ /* CONFIG_LOG_VERBOS is not set */ @@ -88,7 +81,6 @@ /* CONFIG_AARCH32_RAM_LD is not set */ #define CONFIG_AARCH64_RAM_LD -/* CONFIG_QEMU_AARCH32_RAM_LD is not set */ /* CONFIG_USER_DEFINED_LD is not set */ #define CONFIG_LINK_SCRIPT_ROM #define CONFIG_ROM_START_UP_ADDR 0x80100000 @@ -96,8 +88,8 @@ #define CONFIG_LINK_SCRIPT_RAM #define CONFIG_RAM_START_UP_ADDR 0x81000000 #define CONFIG_RAM_SIZE_MB 64 -#define CONFIG_HEAP_SIZE 0x100000 -#define CONFIG_STACK_TOP_ADDR 0x82000000 +#define CONFIG_HEAP_SIZE 1 +#define CONFIG_STACK_SIZE 0x400 /* end of Linker Options */ /* end of Building Option */ diff --git a/example/lwip_test/test_lwip.c b/example/lwip_test/test_lwip.c index eb495493..a9f75863 100644 --- a/example/lwip_test/test_lwip.c +++ b/example/lwip_test/test_lwip.c @@ -22,11 +22,11 @@ #error "Please include sdkconfig.h first" #endif -#ifndef CONFIG_ENABLE_F_GMAC +#ifndef CONFIG_ENABLE_FGMAC #error "Please include component f_gmac first" #endif -#include "gmac.h" +#include "fgmac.h" #include "lwip/ip4_addr.h" #include "lwip/init.h" #include "netif/ethernet.h" @@ -55,7 +55,7 @@ struct ethernetif { struct eth_addr *ethaddr; - GmacCtrl *ethctrl; + FGmac *ethctrl; }; static ip4_addr_t ip_addr, net_mask, gate_way; diff --git a/example/start_up/configs/d2000_aarch32_eg_configs b/example/start_up/configs/d2000_aarch32_eg_configs new file mode 100644 index 00000000..8e72dd20 --- /dev/null +++ b/example/start_up/configs/d2000_aarch32_eg_configs @@ -0,0 +1,142 @@ + +# +# Project Configuration +# + +# +# FT2000-4 AARCH32 FreeRTOS Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +# CONFIG_DEMO_HELLO_WORLD is not set +# CONFIG_DEMO_GET_CPU_STATS is not set +CONFIG_DEMO_MSG_QUEUE=y +# CONFIG_DEMO_SEMAPHORE is not set +# end of FT2000-4 AARCH32 FreeRTOS Configuration +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +CONFIG_TARGET_ARMV8_AARCH32=y +# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +# CONFIG_USE_SYS_TICK is not set +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arch Configuration + +# +# Board Configuration +# +# CONFIG_TARGET_F2000_4 is not set +# CONFIG_TARGET_E2000 is not set +CONFIG_TARGET_D2000=y +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +CONFIG_AARCH32_RAM_LD=y +# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/start_up/configs/d2000_aarch64_eg_configs b/example/start_up/configs/d2000_aarch64_eg_configs new file mode 100644 index 00000000..1ac5110c --- /dev/null +++ b/example/start_up/configs/d2000_aarch64_eg_configs @@ -0,0 +1,136 @@ + +# +# Project Configuration +# + +# +# FT2000-4 AARCH32 FreeRTOS Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +# CONFIG_DEMO_HELLO_WORLD is not set +# CONFIG_DEMO_GET_CPU_STATS is not set +CONFIG_DEMO_MSG_QUEUE=y +# CONFIG_DEMO_SEMAPHORE is not set +# end of FT2000-4 AARCH32 FreeRTOS Configuration +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +# CONFIG_USE_SYS_TICK is not set +# end of Arch Configuration + +# +# Board Configuration +# +# CONFIG_TARGET_F2000_4 is not set +# CONFIG_TARGET_E2000 is not set +CONFIG_TARGET_D2000=y +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x100000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/start_up/configs/ft2004_aarch32_eg_configs b/example/start_up/configs/ft2004_aarch32_eg_configs new file mode 100644 index 00000000..861b811d --- /dev/null +++ b/example/start_up/configs/ft2004_aarch32_eg_configs @@ -0,0 +1,142 @@ + +# +# Project Configuration +# + +# +# FT2000-4 AARCH32 FreeRTOS Configuration +# +CONFIG_TARGET_NAME="ft2004_freertos" +# CONFIG_DEMO_HELLO_WORLD is not set +# CONFIG_DEMO_GET_CPU_STATS is not set +CONFIG_DEMO_MSG_QUEUE=y +# CONFIG_DEMO_SEMAPHORE is not set +# end of FT2000-4 AARCH32 FreeRTOS Configuration +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +CONFIG_TARGET_ARMV8_AARCH32=y +# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arch Configuration + +# +# Board Configuration +# +CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_E2000 is not set +# CONFIG_TARGET_D2000 is not set +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +CONFIG_AARCH32_RAM_LD=y +# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/start_up/configs/ft2004_aarch64_eg_configs b/example/start_up/configs/ft2004_aarch64_eg_configs new file mode 100644 index 00000000..f22d58d7 --- /dev/null +++ b/example/start_up/configs/ft2004_aarch64_eg_configs @@ -0,0 +1,136 @@ + +# +# Project Configuration +# + +# +# FT2000-4 AARCH32 FreeRTOS Configuration +# +CONFIG_TARGET_NAME="ft2004_freertos" +# CONFIG_DEMO_HELLO_WORLD is not set +# CONFIG_DEMO_GET_CPU_STATS is not set +CONFIG_DEMO_MSG_QUEUE=y +# CONFIG_DEMO_SEMAPHORE is not set +# end of FT2000-4 AARCH32 FreeRTOS Configuration +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +# end of Arch Configuration + +# +# Board Configuration +# +CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_E2000 is not set +# CONFIG_TARGET_D2000 is not set +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x100000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/start_up/sdkconfig b/example/start_up/sdkconfig index bf666aa6..b249eaa1 100644 --- a/example/start_up/sdkconfig +++ b/example/start_up/sdkconfig @@ -2,9 +2,16 @@ # # Project Configuration # -CONFIG_TARGET_NAME="ft2004_freertos" -#CONFIG_LWIP_POLL_TEST=y -# CONFIG_LWIP_INTRRUPT_TEST is not set + +# +# FT2000-4 AARCH32 FreeRTOS Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +# CONFIG_DEMO_HELLO_WORLD is not set +# CONFIG_DEMO_GET_CPU_STATS is not set +CONFIG_DEMO_MSG_QUEUE=y +# CONFIG_DEMO_SEMAPHORE is not set +# end of FT2000-4 AARCH32 FreeRTOS Configuration # end of Project Configuration # @@ -15,22 +22,21 @@ CONFIG_USE_FREERTOS=y # # Arch Configuration # -CONFIG_TARGET_ARMV8_AARCH32=y -# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y # CONFIG_TARGET_ARMV7 is not set CONFIG_USE_CACHE=y CONFIG_USE_L3CACHE=y CONFIG_USE_MMU=y -CONFIG_USE_SYS_TICK=y -CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# CONFIG_USE_SYS_TICK is not set # end of Arch Configuration # # Board Configuration # -CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_F2000_4 is not set # CONFIG_TARGET_E2000 is not set -# CONFIG_TARGET_D2000 is not set +CONFIG_TARGET_D2000=y # end of Board Configuration # @@ -39,7 +45,7 @@ CONFIG_TARGET_F2000_4=y # CONFIG_USE_SPI is not set # CONFIG_USE_QSPI is not set CONFIG_USE_GIC=y -CONFIG_EBABLE_GICV3=y +CONFIG_ENABLE_GICV3=y CONFIG_USE_SERIAL=y # @@ -55,15 +61,10 @@ CONFIG_USE_ETH=y # # Eth Configuration # -# CONFIG_ENABLE_F_XMAC is not set -CONFIG_ENABLE_F_GMAC=y - -# -# F_GMAC Configuration -# -# CONFIG_F_GMAC_PHY_COMMON is not set -CONFIG_F_GMAC_PHY_AR803X=y -# end of F_GMAC Configuration +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set # end of Eth Configuration # CONFIG_USE_CAN is not set @@ -73,20 +74,23 @@ CONFIG_F_GMAC_PHY_AR803X=y # CONFIG_USE_PCIE is not set # CONFIG_USE_WDT is not set # CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set # end of Components Configuration -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set # end of Standalone Setting # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y # # Cross-Compiler Setting # CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 # CONFIG_USE_EXT_COMPILER is not set # end of Cross-Compiler Setting @@ -98,10 +102,10 @@ CONFIG_LOG_INFO=y # CONFIG_LOG_NONE is not set # -# GNU Linker Setting +# Linker Options # -CONFIG_AARCH32_RAM_LD=y -# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y # CONFIG_USER_DEFINED_LD is not set CONFIG_LINK_SCRIPT_ROM=y CONFIG_ROM_START_UP_ADDR=0x80100000 @@ -109,9 +113,9 @@ CONFIG_ROM_SIZE_MB=1 CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 -CONFIG_HEAP_SIZE=0x100000 -CONFIG_STACK_SIZE=0x100000 -# end of GNU Linker Setting +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x400 +# end of Linker Options # end of Building Option # @@ -128,11 +132,5 @@ CONFIG_FREERTOS_USE_UART=y # # FreeRTOS Setting # -#CONFIG_USE_LWIP=y - -# -# LWIP Configuration -# -#CONFIG_LWIP_F_GMAC=y -# end of LWIP Configuration +# CONFIG_USE_LWIP is not set # end of FreeRTOS Setting diff --git a/example/start_up/sdkconfig.h b/example/start_up/sdkconfig.h index 179f0cae..ea5cb17a 100644 --- a/example/start_up/sdkconfig.h +++ b/example/start_up/sdkconfig.h @@ -3,9 +3,14 @@ /* Project Configuration */ -#define CONFIG_TARGET_NAME "ft2004_freertos" -/*CONFIG_LWIP_POLL_TEST=y */ -/* CONFIG_LWIP_INTRRUPT_TEST is not set */ +/* FT2000-4 AARCH32 FreeRTOS Configuration */ + +#define CONFIG_TARGET_NAME "d2000_freertos" +/* CONFIG_DEMO_HELLO_WORLD is not set */ +/* CONFIG_DEMO_GET_CPU_STATS is not set */ +#define CONFIG_DEMO_MSG_QUEUE +/* CONFIG_DEMO_SEMAPHORE is not set */ +/* end of FT2000-4 AARCH32 FreeRTOS Configuration */ /* end of Project Configuration */ /* Standalone Setting */ @@ -14,21 +19,20 @@ /* Arch Configuration */ -#define CONFIG_TARGET_ARMV8_AARCH32 -/* CONFIG_TARGET_ARMV8_AARCH64 is not set */ +/* CONFIG_TARGET_ARMV8_AARCH32 is not set */ +#define CONFIG_TARGET_ARMV8_AARCH64 /* CONFIG_TARGET_ARMV7 is not set */ #define CONFIG_USE_CACHE #define CONFIG_USE_L3CACHE #define CONFIG_USE_MMU -#define CONFIG_USE_SYS_TICK -#define CONFIG_USE_AARCH64_L1_TO_AARCH32 +/* CONFIG_USE_SYS_TICK is not set */ /* end of Arch Configuration */ /* Board Configuration */ -#define CONFIG_TARGET_F2000_4 +/* CONFIG_TARGET_F2000_4 is not set */ /* CONFIG_TARGET_E2000 is not set */ -/* CONFIG_TARGET_D2000 is not set */ +#define CONFIG_TARGET_D2000 /* end of Board Configuration */ /* Components Configuration */ @@ -36,7 +40,7 @@ /* CONFIG_USE_SPI is not set */ /* CONFIG_USE_QSPI is not set */ #define CONFIG_USE_GIC -#define CONFIG_EBABLE_GICV3 +#define CONFIG_ENABLE_GICV3 #define CONFIG_USE_SERIAL /* Usart Configuration */ @@ -49,14 +53,10 @@ /* Eth Configuration */ -/* CONFIG_ENABLE_F_XMAC is not set */ -#define CONFIG_ENABLE_F_GMAC - -/* F_GMAC Configuration */ - -/* CONFIG_F_GMAC_PHY_COMMON is not set */ -#define CONFIG_F_GMAC_PHY_AR803X -/* end of F_GMAC Configuration */ +/* CONFIG_ENABLE_FXMAC is not set */ +#define CONFIG_ENABLE_FGMAC +#define CONFIG_FGMAC_PHY_COMMON +/* CONFIG_FGMAC_PHY_AR803X is not set */ /* end of Eth Configuration */ /* CONFIG_USE_CAN is not set */ /* CONFIG_USE_I2C is not set */ @@ -65,17 +65,19 @@ /* CONFIG_USE_PCIE is not set */ /* CONFIG_USE_WDT is not set */ /* CONFIG_USE_DMA is not set */ +/* CONFIG_USE_NAND is not set */ +/* CONFIG_USE_RTC is not set */ /* end of Components Configuration */ -#define CONFIG_USE_LIBC +#define CONFIG_USE_G_LIBC +/* CONFIG_USE_NEW_LIBC is not set */ /* end of Standalone Setting */ /* Building Option */ -#define CONFIG_ENVI_UBUNTU_20_04 - /* Cross-Compiler Setting */ #define CONFIG_COMPILER_NO_STD_STARUP +#define CONFIG_GCC_OPTIMIZE_LEVEL 0 /* CONFIG_USE_EXT_COMPILER is not set */ /* end of Cross-Compiler Setting */ /* CONFIG_LOG_VERBOS is not set */ @@ -85,10 +87,10 @@ /* CONFIG_LOG_ERROR is not set */ /* CONFIG_LOG_NONE is not set */ -/* GNU Linker Setting */ +/* Linker Options */ -#define CONFIG_AARCH32_RAM_LD -/* CONFIG_AARCH64_RAM_LD is not set */ +/* CONFIG_AARCH32_RAM_LD is not set */ +#define CONFIG_AARCH64_RAM_LD /* CONFIG_USER_DEFINED_LD is not set */ #define CONFIG_LINK_SCRIPT_ROM #define CONFIG_ROM_START_UP_ADDR 0x80100000 @@ -96,9 +98,9 @@ #define CONFIG_LINK_SCRIPT_RAM #define CONFIG_RAM_START_UP_ADDR 0x81000000 #define CONFIG_RAM_SIZE_MB 64 -#define CONFIG_HEAP_SIZE 0x100000 -#define CONFIG_STACK_SIZE 0x100000 -/* end of GNU Linker Setting */ +#define CONFIG_HEAP_SIZE 1 +#define CONFIG_STACK_SIZE 0x400 +/* end of Linker Options */ /* end of Building Option */ /* Component Configuration */ @@ -111,12 +113,7 @@ /* FreeRTOS Setting */ -/*CONFIG_USE_LWIP=y */ - -/* LWIP Configuration */ - -/*CONFIG_LWIP_F_GMAC=y */ -/* end of LWIP Configuration */ +/* CONFIG_USE_LWIP is not set */ /* end of FreeRTOS Setting */ #endif diff --git a/example/start_up/test_uart.c b/example/start_up/test_uart.c index 4091994d..735a6af6 100644 --- a/example/start_up/test_uart.c +++ b/example/start_up/test_uart.c @@ -13,21 +13,21 @@ */ #include #include "ft_types.h" -#include "pl011_uart.h" +#include "fpl011.h" #include "gicv3.h" #include "interrupt.h" -static Pl011 pl011_obj; +static FPl011 pl011_obj; void Uart1Init(void) { - Pl011Config config = *Pl011LookupConfig(1); + FPl011Config config = *FPl011LookupConfig(1); printf("config addr: 0x%x \r\n", config.base_address); - Pl011CfgInitialize(&pl011_obj, &config); - Pl011SetOptions(&pl011_obj, FUART_OPTION_UARTEN | FUART_OPTION_RXEN | FUART_OPTION_TXEN | FUART_OPTION_FIFOEN); + FPl011CfgInitialize(&pl011_obj, &config); + FPl011SetOptions(&pl011_obj, FPL011_OPTION_UARTEN | FPL011_OPTION_RXEN | FPL011_OPTION_TXEN | FPL011_OPTION_FIFOEN); } u8 BlockReceive() { - return Pl011BlockReceive(&pl011_obj); + return FPl011BlockReceive(&pl011_obj); } \ No newline at end of file diff --git a/example/template/configs/d2000_aarch32_eg_configs b/example/template/configs/d2000_aarch32_eg_configs new file mode 100644 index 00000000..a3bdac43 --- /dev/null +++ b/example/template/configs/d2000_aarch32_eg_configs @@ -0,0 +1,131 @@ + +# +# Project Configuration +# + +# +# Template Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +# end of Template Configuration +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +CONFIG_TARGET_ARMV8_AARCH32=y +# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +# CONFIG_USE_SYS_TICK is not set +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arch Configuration + +# +# Board Configuration +# +# CONFIG_TARGET_F2000_4 is not set +# CONFIG_TARGET_E2000 is not set +CONFIG_TARGET_D2000=y +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +# CONFIG_USE_SERIAL is not set +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +CONFIG_AARCH32_RAM_LD=y +# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/template/configs/d2000_aarch64_eg_configs b/example/template/configs/d2000_aarch64_eg_configs new file mode 100644 index 00000000..fde19b62 --- /dev/null +++ b/example/template/configs/d2000_aarch64_eg_configs @@ -0,0 +1,125 @@ + +# +# Project Configuration +# + +# +# Template Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +# end of Template Configuration +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +# CONFIG_USE_SYS_TICK is not set +# end of Arch Configuration + +# +# Board Configuration +# +# CONFIG_TARGET_F2000_4 is not set +# CONFIG_TARGET_E2000 is not set +CONFIG_TARGET_D2000=y +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +# CONFIG_USE_SERIAL is not set +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x100000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/template/configs/ft2004_aarch32_eg_configs b/example/template/configs/ft2004_aarch32_eg_configs new file mode 100644 index 00000000..4f195517 --- /dev/null +++ b/example/template/configs/ft2004_aarch32_eg_configs @@ -0,0 +1,138 @@ + +# +# Project Configuration +# + +# +# Template Configuration +# +CONFIG_TARGET_NAME="ft2004_freertos" +# end of Template Configuration +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +CONFIG_TARGET_ARMV8_AARCH32=y +# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# end of Arch Configuration + +# +# Board Configuration +# +CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_E2000 is not set +# CONFIG_TARGET_D2000 is not set +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +CONFIG_AARCH32_RAM_LD=y +# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_SVC_STACK_SIZE=0x1000 +CONFIG_SYS_STACK_SIZE=0x1000 +CONFIG_IRQ_STACK_SIZE=0x1000 +CONFIG_ABORT_STACK_SIZE=0x1000 +CONFIG_FIQ_STACK_SIZE=0x1000 +CONFIG_UNDEF_STACK_SIZE=0x1000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/template/configs/ft2004_aarch64_eg_configs b/example/template/configs/ft2004_aarch64_eg_configs new file mode 100644 index 00000000..57941cf4 --- /dev/null +++ b/example/template/configs/ft2004_aarch64_eg_configs @@ -0,0 +1,132 @@ + +# +# Project Configuration +# + +# +# Template Configuration +# +CONFIG_TARGET_NAME="ft2004_freertos" +# end of Template Configuration +# end of Project Configuration + +# +# Standalone Setting +# +CONFIG_USE_FREERTOS=y + +# +# Arch Configuration +# +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y +# CONFIG_TARGET_ARMV7 is not set +CONFIG_USE_CACHE=y +CONFIG_USE_L3CACHE=y +CONFIG_USE_MMU=y +CONFIG_USE_SYS_TICK=y +# end of Arch Configuration + +# +# Board Configuration +# +CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_E2000 is not set +# CONFIG_TARGET_D2000 is not set +# end of Board Configuration + +# +# Components Configuration +# +# CONFIG_USE_SPI is not set +# CONFIG_USE_QSPI is not set +CONFIG_USE_GIC=y +CONFIG_ENABLE_GICV3=y +CONFIG_USE_SERIAL=y + +# +# Usart Configuration +# +CONFIG_ENABLE_Pl011_UART=y +# end of Usart Configuration + +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +CONFIG_USE_ETH=y + +# +# Eth Configuration +# +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set +# end of Eth Configuration + +# CONFIG_USE_CAN is not set +# CONFIG_USE_I2C is not set +# CONFIG_USE_TIMER is not set +# CONFIG_USE_SDMMC is not set +# CONFIG_USE_PCIE is not set +# CONFIG_USE_WDT is not set +# CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set +# end of Components Configuration + +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Standalone Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 +# CONFIG_USE_EXT_COMPILER is not set +# end of Cross-Compiler Setting + +# CONFIG_LOG_VERBOS is not set +# CONFIG_LOG_DEBUG is not set +CONFIG_LOG_INFO=y +# CONFIG_LOG_WARN is not set +# CONFIG_LOG_ERROR is not set +# CONFIG_LOG_NONE is not set + +# +# Linker Options +# +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y +# CONFIG_USER_DEFINED_LD is not set +CONFIG_LINK_SCRIPT_ROM=y +CONFIG_ROM_START_UP_ADDR=0x80100000 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=1 +CONFIG_STACK_SIZE=0x100000 +# end of Linker Options +# end of Building Option + +# +# Component Configuration +# + +# +# Freertos Drivers +# +CONFIG_FREERTOS_USE_UART=y +# end of Freertos Drivers +# end of Component Configuration + +# +# FreeRTOS Setting +# +# CONFIG_USE_LWIP is not set +# end of FreeRTOS Setting diff --git a/example/template/sdkconfig b/example/template/sdkconfig index bf666aa6..fde19b62 100644 --- a/example/template/sdkconfig +++ b/example/template/sdkconfig @@ -2,9 +2,12 @@ # # Project Configuration # -CONFIG_TARGET_NAME="ft2004_freertos" -#CONFIG_LWIP_POLL_TEST=y -# CONFIG_LWIP_INTRRUPT_TEST is not set + +# +# Template Configuration +# +CONFIG_TARGET_NAME="d2000_freertos" +# end of Template Configuration # end of Project Configuration # @@ -15,22 +18,21 @@ CONFIG_USE_FREERTOS=y # # Arch Configuration # -CONFIG_TARGET_ARMV8_AARCH32=y -# CONFIG_TARGET_ARMV8_AARCH64 is not set +# CONFIG_TARGET_ARMV8_AARCH32 is not set +CONFIG_TARGET_ARMV8_AARCH64=y # CONFIG_TARGET_ARMV7 is not set CONFIG_USE_CACHE=y CONFIG_USE_L3CACHE=y CONFIG_USE_MMU=y -CONFIG_USE_SYS_TICK=y -CONFIG_USE_AARCH64_L1_TO_AARCH32=y +# CONFIG_USE_SYS_TICK is not set # end of Arch Configuration # # Board Configuration # -CONFIG_TARGET_F2000_4=y +# CONFIG_TARGET_F2000_4 is not set # CONFIG_TARGET_E2000 is not set -# CONFIG_TARGET_D2000 is not set +CONFIG_TARGET_D2000=y # end of Board Configuration # @@ -39,15 +41,8 @@ CONFIG_TARGET_F2000_4=y # CONFIG_USE_SPI is not set # CONFIG_USE_QSPI is not set CONFIG_USE_GIC=y -CONFIG_EBABLE_GICV3=y -CONFIG_USE_SERIAL=y - -# -# Usart Configuration -# -CONFIG_ENABLE_Pl011_UART=y -# end of Usart Configuration - +CONFIG_ENABLE_GICV3=y +# CONFIG_USE_SERIAL is not set # CONFIG_USE_GPIO is not set # CONFIG_USE_IOMUX is not set CONFIG_USE_ETH=y @@ -55,15 +50,10 @@ CONFIG_USE_ETH=y # # Eth Configuration # -# CONFIG_ENABLE_F_XMAC is not set -CONFIG_ENABLE_F_GMAC=y - -# -# F_GMAC Configuration -# -# CONFIG_F_GMAC_PHY_COMMON is not set -CONFIG_F_GMAC_PHY_AR803X=y -# end of F_GMAC Configuration +# CONFIG_ENABLE_FXMAC is not set +CONFIG_ENABLE_FGMAC=y +CONFIG_FGMAC_PHY_COMMON=y +# CONFIG_FGMAC_PHY_AR803X is not set # end of Eth Configuration # CONFIG_USE_CAN is not set @@ -73,20 +63,23 @@ CONFIG_F_GMAC_PHY_AR803X=y # CONFIG_USE_PCIE is not set # CONFIG_USE_WDT is not set # CONFIG_USE_DMA is not set +# CONFIG_USE_NAND is not set +# CONFIG_USE_RTC is not set # end of Components Configuration -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set # end of Standalone Setting # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y # # Cross-Compiler Setting # CONFIG_COMPILER_NO_STD_STARUP=y +CONFIG_GCC_OPTIMIZE_LEVEL=0 # CONFIG_USE_EXT_COMPILER is not set # end of Cross-Compiler Setting @@ -98,10 +91,10 @@ CONFIG_LOG_INFO=y # CONFIG_LOG_NONE is not set # -# GNU Linker Setting +# Linker Options # -CONFIG_AARCH32_RAM_LD=y -# CONFIG_AARCH64_RAM_LD is not set +# CONFIG_AARCH32_RAM_LD is not set +CONFIG_AARCH64_RAM_LD=y # CONFIG_USER_DEFINED_LD is not set CONFIG_LINK_SCRIPT_ROM=y CONFIG_ROM_START_UP_ADDR=0x80100000 @@ -109,9 +102,9 @@ CONFIG_ROM_SIZE_MB=1 CONFIG_LINK_SCRIPT_RAM=y CONFIG_RAM_START_UP_ADDR=0x81000000 CONFIG_RAM_SIZE_MB=64 -CONFIG_HEAP_SIZE=0x100000 +CONFIG_HEAP_SIZE=1 CONFIG_STACK_SIZE=0x100000 -# end of GNU Linker Setting +# end of Linker Options # end of Building Option # @@ -128,11 +121,5 @@ CONFIG_FREERTOS_USE_UART=y # # FreeRTOS Setting # -#CONFIG_USE_LWIP=y - -# -# LWIP Configuration -# -#CONFIG_LWIP_F_GMAC=y -# end of LWIP Configuration +# CONFIG_USE_LWIP is not set # end of FreeRTOS Setting diff --git a/example/template/sdkconfig.h b/example/template/sdkconfig.h index 179f0cae..fdb8d1c4 100644 --- a/example/template/sdkconfig.h +++ b/example/template/sdkconfig.h @@ -3,9 +3,10 @@ /* Project Configuration */ -#define CONFIG_TARGET_NAME "ft2004_freertos" -/*CONFIG_LWIP_POLL_TEST=y */ -/* CONFIG_LWIP_INTRRUPT_TEST is not set */ +/* Template Configuration */ + +#define CONFIG_TARGET_NAME "d2000_freertos" +/* end of Template Configuration */ /* end of Project Configuration */ /* Standalone Setting */ @@ -14,21 +15,20 @@ /* Arch Configuration */ -#define CONFIG_TARGET_ARMV8_AARCH32 -/* CONFIG_TARGET_ARMV8_AARCH64 is not set */ +/* CONFIG_TARGET_ARMV8_AARCH32 is not set */ +#define CONFIG_TARGET_ARMV8_AARCH64 /* CONFIG_TARGET_ARMV7 is not set */ #define CONFIG_USE_CACHE #define CONFIG_USE_L3CACHE #define CONFIG_USE_MMU -#define CONFIG_USE_SYS_TICK -#define CONFIG_USE_AARCH64_L1_TO_AARCH32 +/* CONFIG_USE_SYS_TICK is not set */ /* end of Arch Configuration */ /* Board Configuration */ -#define CONFIG_TARGET_F2000_4 +/* CONFIG_TARGET_F2000_4 is not set */ /* CONFIG_TARGET_E2000 is not set */ -/* CONFIG_TARGET_D2000 is not set */ +#define CONFIG_TARGET_D2000 /* end of Board Configuration */ /* Components Configuration */ @@ -36,27 +36,18 @@ /* CONFIG_USE_SPI is not set */ /* CONFIG_USE_QSPI is not set */ #define CONFIG_USE_GIC -#define CONFIG_EBABLE_GICV3 -#define CONFIG_USE_SERIAL - -/* Usart Configuration */ - -#define CONFIG_ENABLE_Pl011_UART -/* end of Usart Configuration */ +#define CONFIG_ENABLE_GICV3 +/* CONFIG_USE_SERIAL is not set */ /* CONFIG_USE_GPIO is not set */ /* CONFIG_USE_IOMUX is not set */ #define CONFIG_USE_ETH /* Eth Configuration */ -/* CONFIG_ENABLE_F_XMAC is not set */ -#define CONFIG_ENABLE_F_GMAC - -/* F_GMAC Configuration */ - -/* CONFIG_F_GMAC_PHY_COMMON is not set */ -#define CONFIG_F_GMAC_PHY_AR803X -/* end of F_GMAC Configuration */ +/* CONFIG_ENABLE_FXMAC is not set */ +#define CONFIG_ENABLE_FGMAC +#define CONFIG_FGMAC_PHY_COMMON +/* CONFIG_FGMAC_PHY_AR803X is not set */ /* end of Eth Configuration */ /* CONFIG_USE_CAN is not set */ /* CONFIG_USE_I2C is not set */ @@ -65,17 +56,19 @@ /* CONFIG_USE_PCIE is not set */ /* CONFIG_USE_WDT is not set */ /* CONFIG_USE_DMA is not set */ +/* CONFIG_USE_NAND is not set */ +/* CONFIG_USE_RTC is not set */ /* end of Components Configuration */ -#define CONFIG_USE_LIBC +#define CONFIG_USE_G_LIBC +/* CONFIG_USE_NEW_LIBC is not set */ /* end of Standalone Setting */ /* Building Option */ -#define CONFIG_ENVI_UBUNTU_20_04 - /* Cross-Compiler Setting */ #define CONFIG_COMPILER_NO_STD_STARUP +#define CONFIG_GCC_OPTIMIZE_LEVEL 0 /* CONFIG_USE_EXT_COMPILER is not set */ /* end of Cross-Compiler Setting */ /* CONFIG_LOG_VERBOS is not set */ @@ -85,10 +78,10 @@ /* CONFIG_LOG_ERROR is not set */ /* CONFIG_LOG_NONE is not set */ -/* GNU Linker Setting */ +/* Linker Options */ -#define CONFIG_AARCH32_RAM_LD -/* CONFIG_AARCH64_RAM_LD is not set */ +/* CONFIG_AARCH32_RAM_LD is not set */ +#define CONFIG_AARCH64_RAM_LD /* CONFIG_USER_DEFINED_LD is not set */ #define CONFIG_LINK_SCRIPT_ROM #define CONFIG_ROM_START_UP_ADDR 0x80100000 @@ -96,9 +89,9 @@ #define CONFIG_LINK_SCRIPT_RAM #define CONFIG_RAM_START_UP_ADDR 0x81000000 #define CONFIG_RAM_SIZE_MB 64 -#define CONFIG_HEAP_SIZE 0x100000 -#define CONFIG_STACK_SIZE 0x100000 -/* end of GNU Linker Setting */ +#define CONFIG_HEAP_SIZE 1 +#define CONFIG_STACK_SIZE 0x400 +/* end of Linker Options */ /* end of Building Option */ /* Component Configuration */ @@ -111,12 +104,7 @@ /* FreeRTOS Setting */ -/*CONFIG_USE_LWIP=y */ - -/* LWIP Configuration */ - -/*CONFIG_LWIP_F_GMAC=y */ -/* end of LWIP Configuration */ +/* CONFIG_USE_LWIP is not set */ /* end of FreeRTOS Setting */ #endif diff --git a/install.py b/install.py index 1beee322..e03dcebe 100644 --- a/install.py +++ b/install.py @@ -86,7 +86,7 @@ os.system("chmod +x ./make/*.mk --silent ") os.system("chmod +x ./lib/Kconfiglib/*.py --silent ") # Add standalone sdk -standalone_sdk_v="v0.1.8" +standalone_sdk_v="v0.1.15" standalone_path=freertos_sdk_path + '/standalone' standalone_branche="master" standalone_remote="https://gitee.com/phytium_embedded/phytium-standalone-sdk.git" diff --git a/make/build_all.mk b/make/build_all.mk new file mode 100644 index 00000000..66b4c72d --- /dev/null +++ b/make/build_all.mk @@ -0,0 +1,74 @@ +# /* +# * @ : Copyright (c) 2021 Phytium Information Technology, Inc. +# * +# * SPDX-License-Identifier: Apache-2.0. +# * +# * @Date: 2021-10-28 14:51:27 +# * @LastEditTime: 2021-10-28 15:04:55 +# * @Description:  This files is for build images for all platform +# * +# * @Modify History: +# * Ver   Who        Date         Changes +# * ----- ------     --------    -------------------------------------- +# */ + +EG_CONFIGS_DIR := ./configs + + +# 根据例程默认,编译各平台的镜像 +.PHONY: load_e2000_aarch32 load_e2000_aarch64 backup_kconfig + +load_ft2004_aarch32: + @echo "========Load for FT2000/4 AARCH32 Start=============" + make ldconfig LDCONFIG_ARG=$(EG_CONFIGS_DIR)/ft2004_aarch32_eg_configs + @echo "==============FT2000/4 AARCH32=======================" + +load_ft2004_aarch64: + @echo "=======Load for FT2000/4 AARCH64 Start===============" + make ldconfig LDCONFIG_ARG=$(EG_CONFIGS_DIR)/ft2004_aarch64_eg_configs + @echo "==============FT2000/4 AARCH64=======================" + +load_d2000_aarch32: + @echo "=======Load for D2000 AARCH32====================" + make ldconfig LDCONFIG_ARG=$(EG_CONFIGS_DIR)/d2000_aarch32_eg_configs + @echo "==============D2000 AARCH32=======================" + +load_d2000_aarch64: + @echo "========Load for D2000 AARCH64===================" + make ldconfig LDCONFIG_ARG=$(EG_CONFIGS_DIR)/d2000_aarch64_eg_configs + @echo "==============D2000 AARCH64=========================" + +load_e2000_aarch32: + @echo "=======Load for E2000 AARCH32====================" + make ldconfig LDCONFIG_ARG=$(EG_CONFIGS_DIR)/e2000_aarch32_eg_configs + @echo "==============E2000 AARCH32=======================" + +load_e2000_aarch64: + @echo "========Load for E2000 AARCH64===================" + make ldconfig LDCONFIG_ARG=$(EG_CONFIGS_DIR)/e2000_aarch64_eg_configs + @echo "==============E2000 AARCH64=========================" + +backup_kconfig: +ifdef CONFIG_TARGET_ARMV8_AARCH32 +ifdef CONFIG_TARGET_D2000 + cp sdkconfig ./configs/d2000_aarch32_eg_configs +endif +ifdef CONFIG_TARGET_F2000_4 + cp sdkconfig ./configs/ft2004_aarch32_eg_configs +endif +ifdef CONFIG_TARGET_E2000 + cp sdkconfig ./configs/e2000_aarch32_eg_configs +endif +endif + +ifdef CONFIG_TARGET_ARMV8_AARCH64 +ifdef CONFIG_TARGET_D2000 + cp sdkconfig ./configs/d2000_aarch64_eg_configs +endif +ifdef CONFIG_TARGET_F2000_4 + cp sdkconfig ./configs/ft2004_aarch64_eg_configs +endif +ifdef CONFIG_TARGET_E2000 + cp sdkconfig ./configs/e2000_aarch64_eg_configs +endif +endif \ No newline at end of file diff --git a/make/build_freertos.mk b/make/build_freertos.mk index 9eeb9548..aafbaedd 100755 --- a/make/build_freertos.mk +++ b/make/build_freertos.mk @@ -8,4 +8,5 @@ include $(FREERTOS_SDK_ROOT)/make/preconfig.mk include $(FREERTOS_SDK_ROOT)/make/complier.mk include $(FREERTOS_SDK_ROOT)/make/buildinfo.mk include $(FREERTOS_SDK_ROOT)/make/packsource.mk -include $(FREERTOS_SDK_ROOT)/make/menuconfig.mk \ No newline at end of file +include $(FREERTOS_SDK_ROOT)/make/menuconfig.mk +include $(FREERTOS_SDK_ROOT)/make/build_all.mk \ No newline at end of file diff --git a/make/complier.mk b/make/complier.mk index e874333d..fd65240f 100755 --- a/make/complier.mk +++ b/make/complier.mk @@ -76,10 +76,12 @@ EXCL_SRC ?= # 在源文件目录中不编译 #OUTPUT_DIR ?= build # 输出目录 $(shell if [ ! -e $(OUTPUT_DIR) ];then mkdir -p $(OUTPUT_DIR); fi) + include $(STANDALONE_DIR)/standalone.mk include $(STANDALONE_DIR)/lib/lib.mk include $(FREERTOS_SDK_ROOT)/make/ld.mk include $(FREERTOS_SDK_ROOT)/third-party/third-party.mk +include $(FREERTOS_SDK_ROOT)/standalone_adaptive.mk INC_DIR := $(INC_DIR) $(USR_INC_DIR) @@ -112,7 +114,7 @@ APP_S_SRC := $(foreach dir, $(SRC_DIR), $(wildcard $(dir)/*.S)) OBJ_FILES := $(patsubst %, $(OUTPUT_DIR)/%, $(APP_S_SRC:.S=.o)) \ $(patsubst %, $(OUTPUT_DIR)/%, $(APP_C_SRC:.c=.o)) -EXCL_OBJS ?= $(patsubst %, $(OUTPUT_DIR)/%, $(EXCL_SRC:.c=.o)) +EXCL_OBJS ?= $(patsubst %, $(OUTPUT_DIR)/%, $(EXCL_SRC:.c=.o) $(EXCL_SRC:.S=.o)) OBJ_FILES := $(filter-out $(EXCL_OBJS), $(OBJ_FILES)) OBJ_FILES += $(LIBC) @@ -135,6 +137,7 @@ ifdef CONFIG_USE_G_LIBC LDFLAGS += -lgcc -L $(LIBPATH) INC_DIR := $(INC_DIR) $(CROSS_PATH)/arm-none-eabi/include OBJ_FILES += $(CROSS_PATH)/arm-none-eabi/lib/thumb/v7/nofp/libc.a \ + $(CROSS_PATH)/arm-none-eabi/lib/thumb/v7/nofp/libm.a \ $(CROSS_PATH)/lib/gcc/arm-none-eabi/$(CC_VERSION)/libgcc.a endif endif @@ -146,6 +149,7 @@ ifdef CONFIG_USE_NEW_LIBC LIBPATH := $(CROSS_PATH)/newlib/arm-none-eabi/newlib INC_DIR := $(INC_DIR) $(CROSS_PATH)/newlib/newlib/libc/include OBJ_FILES += $(CROSS_PATH)/newlib/arm-none-eabi/newlib/libc.a \ + $(CROSS_PATH)/newlib/arm-none-eabi/newlib/libm.a \ $(CROSS_PATH)/lib/gcc/arm-none-eabi/$(CC_VERSION)/libgcc.a endif @@ -153,6 +157,7 @@ ifdef CONFIG_USE_NEW_LIBC LIBPATH := $(CROSS_PATH)/newlib/aarch64-none-elf/newlib INC_DIR := $(INC_DIR) $(CROSS_PATH)/newlib/newlib/libc/include OBJ_FILES += $(CROSS_PATH)/newlib/aarch64-none-elf/newlib/libc.a \ + $(CROSS_PATH)/newlib/aarch64-none-elf/newlib/libm.a \ $(CROSS_PATH)/lib/gcc/aarch64-none-elf/$(CC_VERSION)/libgcc.a endif diff --git a/make/ld/Kconfig b/make/ld/Kconfig index 46a76361..431b8a4e 100644 --- a/make/ld/Kconfig +++ b/make/ld/Kconfig @@ -4,7 +4,6 @@ menu "Linker Options" choice prompt "Select Linker Script Template" optional - default QEMU_AARCH32_RAM_LD if TARGET_AARCH32_QEMU config AARCH32_RAM_LD bool "Use aarch32_ram.ld" @@ -16,23 +15,6 @@ menu "Linker Options" help Use linkscript for booting AARCH64 Baremetal Image from DDR - if USE_BAREMETAL_AMP - config AARCH32_AMP_RAM_MASTER_LD - bool "Use aarch32_amp_master_ram.ld" - help - Use linkscript for booting AARCH32 Master Baremetal Image from DDR - - config AARCH32_AMP_RAM_SLAVE_LD - bool "Use aarch32_amp_slave_ram.ld" - help - Use linkscript for booting AARCH32 Slave Baremetal Image from DDR - endif - - config QEMU_AARCH32_RAM_LD - bool "Use qemu_aarch32_ram.ld" - help - Use linkscript booting AARCH32 Qemu from DDR - config USER_DEFINED_LD bool "Other link script" help @@ -81,25 +63,60 @@ menu "Linker Options" endif config HEAP_SIZE - hex "Heap Size" - default "0x100000" + int "Heap Size (MB)" + default "1" help Assign Heap size in Linkscript - if TARGET_ARMV8_AARCH32 - config STACK_SIZE - hex "Stack Size" - default "0x100000" - help - Assign Stack size in Linkscript - endif + config STACK_SIZE + hex "Stack Size (Byte)" + default "0x100000" + depends on AARCH64_RAM_LD + help + Assign Stack size in Linkscript + + + config SVC_STACK_SIZE + hex "Aarch32 supervisor stack size (Byte)" + default "0x1000" + depends on AARCH32_RAM_LD + help + Assign Stack size in Linkscript + + config SYS_STACK_SIZE + hex "Aarch32 system stack size (Byte)" + default "0x1000" + depends on AARCH32_RAM_LD + help + Assign system stack size in Linkscript + + config IRQ_STACK_SIZE + hex "Aarch32 Irq stack size (Byte)" + default "0x1000" + depends on AARCH32_RAM_LD + help + Assign Irq stack size in Linkscript + + config ABORT_STACK_SIZE + hex "Aarch32 abort stack size (Byte)" + default "0x1000" + depends on AARCH32_RAM_LD + help + Assign abort stack size in Linkscript + + config FIQ_STACK_SIZE + hex "Aarch32 fiq stack size (Byte)" + default "0x1000" + depends on AARCH32_RAM_LD + help + Assign abort stack size in Linkscript + + config UNDEF_STACK_SIZE + hex "Aarch32 undef stack size (Byte)" + default "0x1000" + depends on AARCH32_RAM_LD + help + Assign undef stack size in Linkscript - if TARGET_ARMV8_AARCH64 - config STACK_TOP_ADDR - hex "Stack Top Address" - default "0x82000000" - help - Assign Stack top address in Linkscript - endif endmenu diff --git a/make/ld/aarch32_ram.ld b/make/ld/aarch32_ram.ld index 9d1ff192..590de49c 100644 --- a/make/ld/aarch32_ram.ld +++ b/make/ld/aarch32_ram.ld @@ -3,14 +3,9 @@ OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") OUTPUT_ARCH(arm) -ENTRY(Startup_Aarch32) +ENTRY(_boot) -HEAP_SIZE = DEFINED(__heap_size__) ? __heap_size__ : CONFIG_HEAP_SIZE; - -/* pretend that 0x80100000 is ROM, 0x81000000 is RAM */ -/* because vexpress-qemu is not able to emulate flash memory as ROM */ -/* space is significant to avoid syntax error when linking */ MEMORY { ROM (rx) : ORIGIN = CONFIG_ROM_START_UP_ADDR, LENGTH = CONFIG_ROM_SIZE_MB * 1M @@ -19,95 +14,116 @@ MEMORY SECTIONS { + .vectors : { + *(.boot) + . = ALIGN(64); + KEEP(*(.vectors)) + + } > ROM + .text : { - _text_start = .; - KEEP(*(.Startup_Aarch32)) - *(.vector_table) *(.text*) - *(.rodata*) /* make life easier without rodata section */ + *(.gnu.linkonce.t.*) + *(.plt) + *(.gnu_warning) + *(.gcc_execpt_table) *(.glue_7) /* glue arm to thumb code */ *(.glue_7t) /* glue thumb to arm code */ + *(.vfp11_veneer) + *(.ARM.extab) + *(.gnu.linkonce.armextab.*) + *(.note.gnu.build-id) } > ROM /* .text should linked to ROM */ . = ALIGN(8); /* .ARM.exidx is sorted, so has to go in its own output section. */ - .ARM : - { + .ARM :{ *(.ARM.exidx* .gnu.linkonce.armexidx.*) /* This is used by the startup in order to initialize the .data secion */ } > ROM - - .rodata : - { - *(.rodata .rodata.* .gnu.linkonce.r.*) - - . = ALIGN(8); + + .interp : { + KEEP (*(.interp)) + } > ROM + + .note-ABI-tag : { + KEEP (*(.note-ABI-tag)) + } > ROM + + .rodata :{ + __rodata_start = .; + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r.*) + __rodata_end = .; + } > ROM + + .rodata1 : { + __rodata1_start = .; + *(.rodata1) + *(.rodata1.*) + __rodata1_end = .; + } > ROM + + .le_shell (ALIGN(64)):{ + . = ALIGN(4096); _shell_command_start = .; KEEP (*(shellCommand)) - _shell_command_end = .; - } > ROM + _shell_command_end = .; + . = ALIGN(4096); /* align to page size */ + _shell_code_end = .; + }> ROM - .init : - { + .init :{ KEEP (*(SORT_NONE(.init))) }> ROM - .fini : - { + .fini :{ KEEP (*(SORT_NONE(.fini))) }> ROM - .eh_frame : - { + .eh_frame :{ KEEP (*(.eh_frame)) }> ROM - .ARM.extab : - { + .ARM.extab :{ *(.ARM.extab* .gnu.linkonce.armextab.*) }> ROM - .ARM.exidx : - { + .ARM.exidx :{ __exidx_start = .; *(.ARM.exidx* .gnu.linkonce.armexidx.*) __exidx_end = .; }> ROM - .fini_array : - { + .fini_array :{ PROVIDE_HIDDEN (__fini_array_start = .); KEEP (*(SORT(.fini_array.*))) KEEP (*(.fini_array )) PROVIDE_HIDDEN (__fini_array_end = .); }> ROM - .dtors : - { + .dtors :{ KEEP (*crtbegin.o(.dtors)) KEEP (*crtbegin?.o(.dtors)) KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) KEEP (*(SORT(.dtors.*))) KEEP (*(.dtors)) . = ALIGN(16); - _rom_end = .; + __rom_end__ = .; }> ROM - - . = ALIGN(4096); /* align to page size */ - _text_end = .; - /* data segment, contains data that can be modified by the program at run-time, global and static variables that have a non-zero initial value will normally go here */ - .data : AT(_text_end){ - _data_start = .; /* .data section will be redise at runtime */ + .data : AT(__rom_end__){ + __data_start__ = .; /* .data section will be redise at runtime */ *(.data) . = ALIGN(4096); /* align to page size */ - _data_end = .; + __data_end__ = .; } > RAM /* link it all to RAM */ /* unitialized data segment, variables explicitly initialized with zero to BSS */ - .bss : { + .bss (NOLOAD): { __bss_start__ = .; _bss_start = __bss_start__; *(.bss) @@ -115,33 +131,58 @@ SECTIONS _bss_end = __bss_end__; } > RAM - .heap : - { - . = ALIGN(8); + .sbss (NOLOAD) : { + __sbss_start__ = .; + *(.sbss) + *(.sbss.*) + *(.gnu.linkonce.sb.*) + __sbss_end__ = .; + } > RAM + + .heap (NOLOAD):{ + . = ALIGN(16); __end__ = .; PROVIDE(end = .); HeapBase = .; _heap_start = .; - . += HEAP_SIZE; + . += CONFIG_HEAP_SIZE* 1M; _heap_end = .; HeapLimit = .; /* Add for _sbrk */ } > RAM - _fiq_stack_start = ADDR(.heap) + SIZEOF(.heap); - _fiq_stack_end = _fiq_stack_start + CONFIG_STACK_SIZE; /* 64 KB */ + .stack (NOLOAD):{ + + . = ALIGN(16); + _supervisor_stack_end = .; + . += CONFIG_SVC_STACK_SIZE; + _supervisor_stack = .; + __supervisor_stack = _supervisor_stack; + + . = ALIGN(16); + _irq_stack_end = .; + . += CONFIG_IRQ_STACK_SIZE; + __irq_stack = .; + + __sys_stack = .; + . += CONFIG_SYS_STACK_SIZE; + . = ALIGN(16); + __sys_stack = .; + + _abort_stack_end = .; + . += CONFIG_ABORT_STACK_SIZE; + . = ALIGN(16); + __abort_stack = .; - _irq_stack_start = _fiq_stack_end; - _irq_stack_end = _irq_stack_start + CONFIG_STACK_SIZE; /* 64 KB */ + _fiq_stack_end = .; + . += CONFIG_FIQ_STACK_SIZE; + . = ALIGN(16); + __fiq_stack = .; - _sys_stack_start = _irq_stack_end; - _sys_stack_end = _sys_stack_start + CONFIG_STACK_SIZE; /* 64 KB */ + _undef_stack_end = .; + . += CONFIG_UNDEF_STACK_SIZE; + . = ALIGN(16); + __undef_stack = .; - /* put svc at end and start up with SVC mode */ - _svc_stack_start = _sys_stack_end; - _svc_stack_end = _svc_stack_start + CONFIG_STACK_SIZE; /* 64 KB */ + } > RAM - _irq_stack_size = _irq_stack_end - _irq_stack_start; - _fiq_stack_size = _fiq_stack_end - _fiq_stack_start; - _sys_stack_size = _sys_stack_end - _sys_stack_start; - _svc_stack_size = _svc_stack_end - _svc_stack_start; } diff --git a/make/ld/aarch64_ram.ld b/make/ld/aarch64_ram.ld index ea919ee5..662a5365 100644 --- a/make/ld/aarch64_ram.ld +++ b/make/ld/aarch64_ram.ld @@ -1,127 +1,169 @@ #include "sdkconfig.h" -ENTRY(_boot) - MEMORY { -#if defined(CONFIG_LINK_SCRIPT_ROM) ROM (rx) : ORIGIN = CONFIG_ROM_START_UP_ADDR, LENGTH = CONFIG_ROM_SIZE_MB * 1M -#endif -#if defined(CONFIG_LINK_SCRIPT_RAM) RAM (rwx): ORIGIN = CONFIG_RAM_START_UP_ADDR, LENGTH = CONFIG_RAM_SIZE_MB * 1M -#endif } +ENTRY(_vector_table) SECTIONS { + .text : { + KEEP (*(.vectors)) + *(.boot) + *(.text) + *(.text.*) + *(.gnu.linkonce.t.*) + *(.plt) + *(.gnu_warning) + *(.gcc_execpt_table) + *(.glue_7) + *(.glue_7t) + *(.ARM.extab) + *(.gnu.linkonce.armextab.*) + } > ROM - .text : - { - KEEP(*(.StartUp)) - KEEP(*(.vectors)) - KEEP(*(.text.boot)) - *(.text) - . = ALIGN(8); - }> ROM + .got : { + *(.got) + } > ROM + .got1 : { + *(.got1) + } > ROM - .rodata : - { - *(.rodata .rodata.* .gnu.linkonce.r.*) + .got2 : { + *(.got2) + } > ROM - . = ALIGN(8); - _shell_command_start = .; - KEEP (*(shellCommand)) - _shell_command_end = .; + .note.gnu.build-id : { + KEEP (*(.note.gnu.build-id)) } > ROM - .init : - { - KEEP (*(SORT_NONE(.init))) - }> ROM + .init (ALIGN(64)): { + KEEP (*(.init)) + } > ROM - .fini : - { - KEEP (*(SORT_NONE(.fini))) - }> ROM + .fini (ALIGN(64)): { + KEEP (*(.fini)) + } > ROM - .eh_frame : - { - KEEP (*(.eh_frame)) - }> ROM + .interp : { + __interp_start = .; + KEEP (*(.interp)) + __interp_end = .; + } > ROM - .ARM.extab : - { - *(.ARM.extab* .gnu.linkonce.armextab.*) - }> ROM + .note-ABI-tag : { + __note-ABI-tag_start = .; + KEEP (*(.note-ABI-tag)) + __note-ABI-tag_end = .; + } > ROM - .ARM.exidx : - { - __exidx_start = .; - *(.ARM.exidx* .gnu.linkonce.armexidx.*) - __exidx_end = .; - }> ROM + .preinit_array : { + __preinit_array_start = .; + KEEP (*(SORT(.preinit_array.*))) + KEEP (*(.preinit_array)) + __preinit_array_end = .; + } > ROM - .fini_array : - { - PROVIDE_HIDDEN (__fini_array_start = .); - KEEP (*(SORT(.fini_array.*))) - KEEP (*(.fini_array )) - PROVIDE_HIDDEN (__fini_array_end = .); - }> ROM + .init_array : { + __init_array_start = .; + KEEP (*(SORT(.init_array.*))) + KEEP (*(.init_array)) + __init_array_end = .; + } > ROM - .dtors : - { - KEEP (*crtbegin.o(.dtors)) - KEEP (*crtbegin?.o(.dtors)) - KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o ) .dtors)) - KEEP (*(SORT(.dtors.*))) - KEEP (*(.dtors)) - . = ALIGN(16); - _rom_end = .; + .fini_array : { + __fini_array_start = .; + KEEP (*(SORT(.fini_array.*))) + KEEP (*(.fini_array)) + __fini_array_end = .; + } > ROM + + .rodata (ALIGN(64)): { + __rodata_start = .; + *(.rodata) + *(.rodata.*) + *(.gnu.linkonce.r.*) + __rodata_end = .; + } > ROM + + .le_shell (ALIGN(64)):{ + . = ALIGN(4096); + _shell_command_start = .; + KEEP (*(shellCommand)) + _shell_command_end = .; + . = ALIGN(4096); /* align to page size */ + _shell_code_end = .; }> ROM - .data :AT(ADDR(.dtors) + SIZEOF(.dtors)) - { - __data_start = .; - *(.data) - *(.data .data.* .gnu.linkonce.d.*) - SORT(CONSTRUCTORS) + + .rodata1 (ALIGN(64)): { + __rodata1_start = .; + *(.rodata1) + *(.rodata1.*) + __rodata1_end = .; + } > ROM + + + .gcc_except_table : { + *(.gcc_except_table) + . = ALIGN(16); + __rom_end__ = .; + } > ROM + + + .data :AT(ADDR(.gcc_except_table) + SIZEOF(.gcc_except_table)){ + __data_start__ = .; + *(.data) + *(.data.*) + *(.gnu.linkonce.d.*) + *(.jcr) + *(.got) + *(.got.plt) . = ALIGN(4096); /* align to page size */ - __data_end = .; - }> RAM + __data_end__ = .; + } > RAM + .sbss (NOLOAD) : { + __sbss_start__ = .; + *(.sbss) + *(.sbss.*) + *(.gnu.linkonce.sb.*) + __sbss_end__ = .; + } > RAM + .bss (NOLOAD) : { + . = ALIGN(64); + __bss_start__ = .; + *(.bss) + *(.bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + . = ALIGN(64); + __bss_end__ = .; + } > RAM - .bss : - { - . = ALIGN(8); - __bss_start__ = .; - __bss_start = __bss_start__; - bss = .; - *(.bss) - . = ALIGN(8); - __bss_end__ = .; - __bss_end = __bss_end__; - }> RAM - .heap (NOLOAD): - { + .heap (NOLOAD):{ . = ALIGN(64); - __end__ = .; - PROVIDE(end = .); + _heap = .; HeapBase = .; _heap_start = .; - . = . + CONFIG_HEAP_SIZE; + . = . + CONFIG_HEAP_SIZE* 1M; _heap_end = .; HeapLimit = .; } > RAM - . = CONFIG_STACK_TOP_ADDR ; /* stack memory */ - stack_top = .; + .stack (NOLOAD) : { + . = ALIGN(64); + _el1_stack_end = .; + . += CONFIG_STACK_SIZE; + __el1_stack = .; + } > RAM } -__bss_size = (__bss_end - __bss_start)>>3; \ No newline at end of file diff --git a/make/menuconfig.mk b/make/menuconfig.mk index 959b6949..61433c51 100755 --- a/make/menuconfig.mk +++ b/make/menuconfig.mk @@ -38,6 +38,11 @@ lddefconfig: @cp $(FREERTOS_SDK_ROOT)/configs/$(DEF_KCONFIG) ./$(KCONFIG_CONFIG) -f @echo "get default configs at " $(FREERTOS_SDK_ROOT)/configs/$(DEF_KCONFIG) +ldconfig: + cp $(LDCONFIG_ARG) ./$(KCONFIG_CONFIG) -f + @echo "get configs at " $(LDCONFIG_ARG) + $(STANDALONE_DIR)/lib/Kconfiglib/genconfig.py + # load default configs,then generate sdkconfig.h, and clean build targets # support platform # FT2000/4 AARCH32/AARCH64 diff --git a/standalone_adaptive.mk b/standalone_adaptive.mk new file mode 100644 index 00000000..1225afa2 --- /dev/null +++ b/standalone_adaptive.mk @@ -0,0 +1,11 @@ + +EXCL_SRC += $(FREERTOS_SDK_ROOT)/standalone/common/fmemory_pool.c + + +ifdef CONFIG_TARGET_ARMV8_AARCH64 +EXCL_SRC += $(FREERTOS_SDK_ROOT)/standalone/arch/armv8/aarch64/gcc/boot.S +EXCL_SRC += $(FREERTOS_SDK_ROOT)/standalone/arch/armv8/aarch64/gcc/vectors.S +EXCL_SRC += $(FREERTOS_SDK_ROOT)/standalone/arch/armv8/aarch64/gcc/vectors_g.c +else +EXCL_SRC += $(FREERTOS_SDK_ROOT)/standalone/arch/armv8/aarch32/gcc/vector.S +endif diff --git a/third-party/Kconfig b/third-party/Kconfig index 0bae1131..3071d5eb 100644 --- a/third-party/Kconfig +++ b/third-party/Kconfig @@ -1,9 +1,3 @@ -# config USE_COREMARK -# bool -# depends on USE_LIBC -# prompt "Use Coremark" -# help -# Include Coremark for Benchmark config USE_LWIP bool diff --git a/third-party/freertos/portable/GCC/ft_platform/aarch32/FreeRTOSConfig.h b/third-party/freertos/portable/GCC/ft_platform/aarch32/FreeRTOSConfig.h index 7d013424..71a59afd 100644 --- a/third-party/freertos/portable/GCC/ft_platform/aarch32/FreeRTOSConfig.h +++ b/third-party/freertos/portable/GCC/ft_platform/aarch32/FreeRTOSConfig.h @@ -205,8 +205,8 @@ nothing to return to. To avoid this define configTASK_RETURN_ADDRESS to 0. */ vClearTickInterrupt(); \ }while (0) -#define FreeRTOS_IRQ_Handler IRQ_Handler -#define FreeRTOS_SWI_Handler SWI_Handler +#define FreeRTOS_IRQ_Handler IRQHandler +#define FreeRTOS_SWI_Handler SWIHandler #define configINTERRUPT_CONTROLLER_BASE_ADDRESS (0x71800000) #define configINTERRUPT_CONTROLLER_CPU_INTERFACE_OFFSET (0x2000UL) diff --git a/third-party/freertos/portable/GCC/ft_platform/aarch32/vector.S b/third-party/freertos/portable/GCC/ft_platform/aarch32/vector.S new file mode 100644 index 00000000..d7615cf2 --- /dev/null +++ b/third-party/freertos/portable/GCC/ft_platform/aarch32/vector.S @@ -0,0 +1,80 @@ +.globl _boot +.globl _vector_table + +.globl FiqInterruptHandler +.globl DataAbortInterruptHandler +.globl PrefetchAbortInterruptHandler +.globl UndefineInterruptHandler + + +.set EXCEPTION_FRAME_SIZE, (17*4) + +/* allocatable and executable */ +.section .vectors, "a" + +_vector_table: + B _boot + B Undefined + B SWIHandler + B PrefetchAbortHandler + B DataAbortHandler + NOP /* Placeholder for address exception vector*/ + B IRQHandler + B FiqHandler + + + + +.macro PushExceptionReg + sub sp, sp, #EXCEPTION_FRAME_SIZE /* Sizeof(ExceptionFrame) */ + stmia sp, {r0 - r12} /* Calling r0-r12 */ + mov r0, sp + mrs r6, spsr /* Save CPSR */ + str lr, [r0, #15*4] /* Push PC */ + str r6, [r0, #16*4] /* Push CPSR */ + cps #0x13 /* C运行环境所运行的模式 */ + str sp, [r0, #13*4] /* Save calling SP */ + str lr, [r0, #14*4] /* Save calling PC */ +.endm + + + +.align 4 +.arm +.weak IRQHandler +.type IRQHandler, %function +@.global IRQHandler +IRQHandler: /* 0x18 IRQ */ + bl IRQHandler + bl . + + +.align 4 +.arm +.weak SWIHandler +.type SWIHandler, %function +@.global SWIHandler +SWIHandler: /* 0x18 IRQ */ + bl SWIHandler + bl . + +Undefined: /* Undefined handler */ + PushExceptionReg + cps #0x1B + bl UndefineInterruptHandler + bl . + +PrefetchAbortHandler: + PushExceptionReg + bl PrefetchAbortInterruptHandler + bl . + +DataAbortHandler: + PushExceptionReg + bl DataAbortInterruptHandler + bl . + +FiqHandler: /* FIQ vector handler */ + PushExceptionReg + bl FiqInterruptHandler + bl . \ No newline at end of file diff --git a/third-party/freertos/portable/GCC/ft_platform/aarch64/FreeRTOSConfig.h b/third-party/freertos/portable/GCC/ft_platform/aarch64/FreeRTOSConfig.h index 07566640..45ec5d24 100644 --- a/third-party/freertos/portable/GCC/ft_platform/aarch64/FreeRTOSConfig.h +++ b/third-party/freertos/portable/GCC/ft_platform/aarch64/FreeRTOSConfig.h @@ -188,4 +188,8 @@ QEMU-Virt. */ #define configUSE_TRACE_FACILITY 1 + +#define FreeRTOS_IRQ_Handler IRQInterruptHandler +#define FreeRTOS_SWI_Handler SynchronousInterruptHandler + #endif /* FREERTOS_CONFIG_H */ diff --git a/third-party/freertos/portable/GCC/ft_platform/aarch64/boot.S b/third-party/freertos/portable/GCC/ft_platform/aarch64/boot.S new file mode 100644 index 00000000..39ea6c03 --- /dev/null +++ b/third-party/freertos/portable/GCC/ft_platform/aarch64/boot.S @@ -0,0 +1,126 @@ + + +.global _boot + +.global _vector_table + + +.set vector_base, _vector_table +.set el1_stack, __el1_stack + + + +.section .boot,"ax" + +_boot: + mrs x0, CurrentEL + cmp x0, 0xc + b.eq El3Entry + cmp x0, 0x8 + b.eq El2Entry + cmp x0, 0x4 + b.eq El1Entry + bne hang + El3Entry: + /* initialize sctlr_el2 and hcr_el2 to save values before entering el2.*/ + msr sctlr_el2, xzr + msr hcr_el2, xzr + /* determine the el2 execution state.*/ + mrs x0, scr_el3 + orr x0, x0, #(1<<10) + /* rw el2 execution state is aarch64.*/ + orr x0, x0, #(1<<0) + /* ns el1 is non-secure world.*/ + msr scr_el3, x0 + mov x0, #0b01001 + /* daif=0000 */ + msr spsr_el3, x0 + /* m[4:0]=01001 el2h must match scr_el3.rw*/ + + /* determine el2 entry.*/ + adr x0, El2Entry + /* El2Entry points to the first instruction of */ + msr elr_el3, x0 + /* el2 code.*/ + eret + El2Entry: + + /* initialize the sctlr_el1 register before entering el1.*/ + msr sctlr_el1, xzr + mrs x0, hcr_el2 + orr x0, x0, #(1<<31) + /* rw=1 el1 execution state is aarch64.*/ + msr hcr_el2, x0 + mov x0, #0b00101 + /* daif=0000 */ + msr spsr_el2, x0 + /* m[4:0]=00101 el1h must match hcr_el2.rw.*/ + adr x0, El1Entry + /* El1Entry points to the first instruction of */ + msr elr_el2, x0 + /* el1 code.*/ + eret + +El1Entry: +InitEl1: + mov x0, #0 + mov x1, #0 + mov x2, #0 + mov x3, #0 + mov x4, #0 + mov x5, #0 + mov x6, #0 + mov x7, #0 + mov x8, #0 + mov x9, #0 + mov x10, #0 + mov x11, #0 + mov x12, #0 + mov x13, #0 + mov x14, #0 + mov x15, #0 + mov x16, #0 + mov x17, #0 + mov x18, #0 + mov x19, #0 + mov x20, #0 + mov x21, #0 + mov x22, #0 + mov x23, #0 + mov x24, #0 + mov x25, #0 + mov x26, #0 + mov x27, #0 + mov x28, #0 + mov x29, #0 + mov x30, #0 + mov x1,#0x0 + msr SCTLR_EL1, x1 + isb + + /* Set vector table base address */ + ldr x1,=vector_base + msr VBAR_EL1,x1 + + + /* Trap floating point access only in case of standalone BSP */ + mrs x0, CPACR_EL1 + /* bic x0, x0, #(0x3 << 20) */ + orr x0, x0, #(0x3 << 20) + msr CPACR_EL1, x0 + isb + + + /* Define stack pointer for current exception level */ + ldr x2,=el1_stack + mov sp,x2 + + bl _startup /* jump to start */ + + +hang: + wfi + b HangPrint + b hang + + diff --git a/third-party/freertos/portable/GCC/ft_platform/aarch64/port.c b/third-party/freertos/portable/GCC/ft_platform/aarch64/port.c index 0798bcaf..307d5ba0 100644 --- a/third-party/freertos/portable/GCC/ft_platform/aarch64/port.c +++ b/third-party/freertos/portable/GCC/ft_platform/aarch64/port.c @@ -323,7 +323,6 @@ BaseType_t xPortStartScheduler(void) /* Start the timer that generates the tick ISR. */ configSETUP_TICK_INTERRUPT(); - /* Start the first task executing. */ vPortRestoreTaskContext(); } diff --git a/third-party/freertos/portable/GCC/ft_platform/aarch64/portASM.S b/third-party/freertos/portable/GCC/ft_platform/aarch64/portASM.S index 5530452f..1c8b1ad0 100644 --- a/third-party/freertos/portable/GCC/ft_platform/aarch64/portASM.S +++ b/third-party/freertos/portable/GCC/ft_platform/aarch64/portASM.S @@ -32,6 +32,7 @@ .extern ullMaxAPIPriorityMask .extern pxCurrentTCB .extern vTaskSwitchContext + .extern _freertos_vector_table .extern vApplicationIRQHandler .extern ullPortInterruptNesting .extern ullPortTaskHasFPUContext @@ -39,7 +40,7 @@ .extern ullPortYieldRequired .extern ullICCEOIR .extern ullICCIAR - .extern _freertos_vector_table + .extern _vector_table .global FreeRTOS_IRQ_Handler .global FreeRTOS_SWI_Handler @@ -257,7 +258,7 @@ FreeRTOS_Abort: .align 8 .type vPortRestoreTaskContext, %function vPortRestoreTaskContext: -.set freertos_vector_base, _freertos_vector_table +.set freertos_vector_base, _freertos_vector_table /* Install the FreeRTOS interrupt handlers. */ LDR X1, =freertos_vector_base diff --git a/third-party/freertos/portable/GCC/ft_platform/aarch64/portAsm_debug.c b/third-party/freertos/portable/GCC/ft_platform/aarch64/portAsm_debug.c new file mode 100644 index 00000000..5384a889 --- /dev/null +++ b/third-party/freertos/portable/GCC/ft_platform/aarch64/portAsm_debug.c @@ -0,0 +1,22 @@ +/* + * @ : Copyright (c) 2021 Phytium Information Technology, Inc. + * + * SPDX-License-Identifier: Apache-2.0. + * + * @Date: 2021-12-15 17:24:04 + * @LastEditTime: 2021-12-15 17:28:22 + * @Description:  This files is for + * + * @Modify History: + * Ver   Who        Date         Changes + * ----- ------     --------    -------------------------------------- + */ + + +#include "stdio.h" + +void test_value(void * x0 ,void * x1,void * x2 ,void * x3) +{ + printf("x2 %p \r\n",x2) ; + while (1) ; +} \ No newline at end of file diff --git a/third-party/freertos/portable/GCC/ft_platform/aarch64/vectors.S b/third-party/freertos/portable/GCC/ft_platform/aarch64/vectors.S new file mode 100644 index 00000000..d70bf54b --- /dev/null +++ b/third-party/freertos/portable/GCC/ft_platform/aarch64/vectors.S @@ -0,0 +1,314 @@ + +.globl _boot +.globl _vector_table +.globl _freertos_vector_table + +.globl FiqInterrupt +.globl IrqInterrupt +.globl SerrorInterrupt +.globl SynchronousInterrupt +.globl fpu_status + + + + +.macro SaveRegister + stp X0,X1, [sp,#-0x10]! + stp X2,X3, [sp,#-0x10]! + stp X4,X5, [sp,#-0x10]! + stp X6,X7, [sp,#-0x10]! + stp X8,X9, [sp,#-0x10]! + stp X10,X11, [sp,#-0x10]! + stp X12,X13, [sp,#-0x10]! + stp X14,X15, [sp,#-0x10]! + stp X16,X17, [sp,#-0x10]! + stp X18,X19, [sp,#-0x10]! + stp X29,X30, [sp,#-0x10]! +.endm + + +.macro RestoreRegister + ldp X29,X30, [sp], #0x10 + ldp X18,X19, [sp], #0x10 + ldp X16,X17, [sp], #0x10 + ldp X14,X15, [sp], #0x10 + ldp X12,X13, [sp], #0x10 + ldp X10,X11, [sp], #0x10 + ldp X8,X9, [sp], #0x10 + ldp X6,X7, [sp], #0x10 + ldp X4,X5, [sp], #0x10 + ldp X2,X3, [sp], #0x10 + ldp X0,X1, [sp], #0x10 +.endm + + +.macro SaveFloatregister + bl FloatSave +/* Load the floating point context array address from fpu_context_base */ + ldr x1,=fpu_context_base + ldr x0, [x1] + +/* Save all the floating point register to the array */ + stp q0,q1, [x0], #0x20 + stp q2,q3, [x0], #0x20 + stp q4,q5, [x0], #0x20 + stp q6,q7, [x0], #0x20 + stp q8,q9, [x0], #0x20 + stp q10,q11, [x0], #0x20 + stp q12,q13, [x0], #0x20 + stp q14,q15, [x0], #0x20 + stp q16,q17, [x0], #0x20 + stp q18,q19, [x0], #0x20 + stp q20,q21, [x0], #0x20 + stp q22,q23, [x0], #0x20 + stp q24,q25, [x0], #0x20 + stp q26,q27, [x0], #0x20 + stp q28,q29, [x0], #0x20 + stp q30,q31, [x0], #0x20 + mrs x2, FPCR + mrs x3, FPSR + stp x2, x3, [x0], #0x10 + +/* Save current address of floating point context array to fpu_context_base */ + str x0, [x1] +.endm + +.macro RestoreFloatRegister + +/* Restore the address of floating point context array from fpu_context_base */ + ldr x1,=fpu_context_base + ldr x0, [x1] + +/* Restore all the floating point register from the array */ + ldp x2, x3, [x0,#-0x10]! + msr FPCR, x2 + msr FPSR, x3 + ldp q30,q31, [x0,#-0x20]! + ldp q28,q29, [x0,#-0x20]! + ldp q26,q27, [x0,#-0x20]! + ldp q24,q25, [x0,#-0x20]! + ldp q22,q23, [x0,#-0x20]! + ldp q20,q21, [x0,#-0x20]! + ldp q18,q19, [x0,#-0x20]! + ldp q16,q17, [x0,#-0x20]! + ldp q14,q15, [x0,#-0x20]! + ldp q12,q13, [x0,#-0x20]! + ldp q10,q11, [x0,#-0x20]! + ldp q8,q9, [x0,#-0x20]! + ldp q6,q7, [x0,#-0x20]! + ldp q4,q5, [x0,#-0x20]! + ldp q2,q3, [x0,#-0x20]! + ldp q0,q1, [x0,#-0x20]! + +/* Save current address of floating point context array to fpu_context_base */ + str x0, [x1] +.endm + +.org 0 + +.section .vectors, "a" + +_vector_table: +.set VBAR, _vector_table +.org VBAR + + b _boot +.org (VBAR + 0x200) + b SynchronousInterruptHandler + +.org (VBAR + 0x280) + b IRQInterruptHandler + +.org (VBAR + 0x300) + b FIQInterruptHandler + +.org (VBAR + 0x380) + b SErrorInterruptHandler + + +SynchronousInterruptHandler: + SaveRegister +/* Check if the Synchronous abort is occurred due to floating point access. */ + mrs x0, ESR_EL1 + + and x0, x0, #(0x3F << 26) + mov x1, #(0x7 << 26) + cmp x0, x1 +/* If exception is not due to floating point access go to synchronous handler */ + bne Synchronoushandler + +/* + * If excpetion occurred due to floating point access, Enable the floating point + * access i.e. do not trap floating point instruction + */ + + mrs x1,CPACR_EL1 + orr x1, x1, #(0x1<<20) + msr CPACR_EL1, x1 + isb + +/* If the floating point access was previously enabled, store FPU context + * registers(StoreFloat). + */ + ldr x0, =fpu_status + ldrb w1,[x0] + cbnz w1, StoreFloat +/* + * If the floating point access was not enabled previously, save the status of + * floating point accessibility i.e. enabled and store floating point context + * array address(fpu_context) to fpu_context_base. + */ + mov w1, #0x1 + strb w1, [x0] + ldr x0, =fpu_context + ldr x1, =fpu_context_base + str x0,[x1] + b RestoreContext +StoreFloat: + SaveFloatRegister + b RestoreContext +Synchronoushandler: /* 此处还需要进行压栈处理,位函数内提供打印信息 */ + mrs x0, CPACR_EL1 + mrs x1, ELR_EL1 + mrs x2, SPSR_EL1 + stp x0, x1, [sp,#-0x10]! + mov x21, sp + add x21, x21, #208 + stp x21,x21, [sp,#-0x10]! + mov x0, sp + + bl SynchronousInterrupt +RestoreContext: + RestoreRegister + eret + + +IRQInterruptHandler: + SaveRegister +/* Save the status of SPSR, ELR and CPTR to stack */ + mrs x0, CPACR_EL1 + mrs x1, ELR_EL1 + mrs x2, SPSR_EL1 + + stp x0, x1, [sp,#-0x10]! + str x2, [sp,#-0x10]! + +/* Trap floating point access */ + mrs x1,CPACR_EL1 + bic x1, x1, #(0x1<<20) + msr CPACR_EL1, x1 + isb + + bl IRQInterrupt +/* + * If floating point access is enabled during interrupt handling, + * restore floating point registers. + */ + mrs x0,CPACR_EL1 + ands x0, x0, #(0x1<<20) + beq RestorePrevState + + RestoreFloatRegister + +/* Restore the status of SPSR, ELR and CPTR from stack */ +RestorePrevState: + ldr x2,[sp],0x10 + ldp x0, x1, [sp],0x10 + + msr CPACR_EL1, x0 + msr ELR_EL1, x1 + msr SPSR_EL1, x2 + + RestoreRegister + eret + +FIQInterruptHandler: + + SaveRegister + + bl FIQInterrupt + + RestoreRegister + + eret + +SErrorInterruptHandler: + + SaveRegister + /* Save the status of SPSR, ELR and CPTR to stack */ + mrs x0, CPACR_EL1 + mrs x1, ELR_EL1 + mrs x2, SPSR_EL1 + stp x0, x1, [sp,#-0x10]! + mov x21, sp + add x21, x21, #208 + stp x21,x21, [sp,#-0x10]! + mov x0, sp + + mov x0, sp + bl SErrorInterrupt + + RestoreRegister + + eret + + + + +.set FREERTOS_VBAR, (VBAR+0x2000) + +.org(FREERTOS_VBAR) +_freertos_vector_table: + b FreeRTOS_SWI_Handler + +.org (FREERTOS_VBAR + 0x80) + b FreeRTOS_IRQ_Handler + +.org (FREERTOS_VBAR + 0x100) + b . + +.org (FREERTOS_VBAR + 0x180) + b . + +.org (FREERTOS_VBAR + 0x200) + b FreeRTOS_SWI_Handler + +.org (FREERTOS_VBAR + 0x280) + b FreeRTOS_IRQ_Handler + +.org (FREERTOS_VBAR + 0x300) + b . + +.org (FREERTOS_VBAR + 0x380) + b SErrorInterruptHandler /* SError/vSError */ + +.org (FREERTOS_VBAR + 0x400) + b . + +.org (FREERTOS_VBAR + 0x480) + b . + +.org (FREERTOS_VBAR + 0x500) + b . + +.org (FREERTOS_VBAR + 0x580) + b . + +.org (FREERTOS_VBAR + 0x600) + b . + +.org (FREERTOS_VBAR + 0x680) + b . + +.org (FREERTOS_VBAR + 0x700) + b . + +.org (FREERTOS_VBAR + 0x780) + b . + +.org (FREERTOS_VBAR + 0x800) + + +.align 8 + +.end \ No newline at end of file diff --git a/third-party/freertos/portable/GCC/ft_platform/aarch64/vectors_g.c b/third-party/freertos/portable/GCC/ft_platform/aarch64/vectors_g.c new file mode 100644 index 00000000..276897eb --- /dev/null +++ b/third-party/freertos/portable/GCC/ft_platform/aarch64/vectors_g.c @@ -0,0 +1,25 @@ +/* + * @ : Copyright (c) 2021 Phytium Information Technology, Inc. + * + * SPDX-License-Identifier: Apache-2.0. + * + * @Date: 2021-12-15 11:26:01 + * @LastEditTime: 2021-12-15 11:52:25 + * @Description:  This files is for + * + * @Modify History: + * Ver   Who        Date         Changes + * ----- ------     --------    -------------------------------------- + */ + + + + + + +#include "ft_types.h" + + +volatile u8 fpu_context[528] ; +volatile u8 *fpu_context_base ; +volatile u8 fpu_status ; diff --git a/third-party/freertos/portable/freertos_configs.c b/third-party/freertos/portable/freertos_configs.c index 6430e7d4..97cef5a6 100644 --- a/third-party/freertos/portable/freertos_configs.c +++ b/third-party/freertos/portable/freertos_configs.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0. * * @Date: 2021-07-05 08:35:41 - * @LastEditTime: 2021-07-21 19:04:40 + * @LastEditTime: 2021-12-15 16:59:45 * @Description:  This files is for * * @Modify History: @@ -18,7 +18,6 @@ #include "gicv3.h" #include "generic_timer.h" #include "interrupt.h" -#include "trap.h" #include #include "ft_assert.h" @@ -55,16 +54,16 @@ static u32 cntfrq; /* System frequency */ void vConfigureTickInterrupt(void) { - // Disable the timer + /* Disable the timer */ GenericTimerStop(); - // Get system frequency + /* Get system frequency */ cntfrq = GenericTimerFrequecy(); - - // Set tick rate + + /* Set tick rate */ GenericTimerCompare(cntfrq / configTICK_RATE_HZ); GenericTimerInterruptEnable(); - // Set as the lowest priority + /* Set as the lowest priority */ InterruptSetPriority(GENERIC_TIMER_NS_IRQ_NUM, configKERNEL_INTERRUPT_PRIORITY); InterruptUmask(GENERIC_TIMER_NS_IRQ_NUM); @@ -76,9 +75,31 @@ void vClearTickInterrupt(void) GenericTimerCompare(cntfrq / configTICK_RATE_HZ); } + +static void vFIrqHandler(int ir) +{ + void *param; + IrqHandler isr_func; + extern struct IrqDesc isr_table[]; + + /* get interrupt service routine */ + isr_func = isr_table[ir].handler; + if (isr_func) + { + /* Interrupt for myself. */ + param = isr_table[ir].param; + /* turn to interrupt service routine */ + isr_func(ir, param); + } + + /* end of interrupt */ + InterruptAck(ir); +} + volatile unsigned int gCpuRuntime; #ifdef __aarch64__ + void vApplicationIRQHandler(uint32_t ulICCIAR) { int ulInterruptID; @@ -97,17 +118,18 @@ void vApplicationIRQHandler(uint32_t ulICCIAR) } else { - SystemIrqHandler(ulInterruptID); + vFIrqHandler(ulInterruptID); } } #else + void vApplicationFPUSafeIRQHandler(uint32_t ulICCIAR) { int ulInterruptID; /* Interrupts cannot be re-enabled until the source of the interrupt is - cleared. The ID of the interrupt is obtained by bitwise ANDing the ICCIAR - value with 0x3FF. */ + cleared. The ID of the interrupt is obtained by bitwise ANDing the ICCIAR + value with 0x3FF. */ ulInterruptID = ulICCIAR & 0x3FFUL; /* call handler function */ @@ -116,11 +138,10 @@ void vApplicationFPUSafeIRQHandler(uint32_t ulICCIAR) /* Generic Timer */ gCpuRuntime++; FreeRTOS_Tick_Handler(); - } else - { - SystemIrqHandler(ulInterruptID); + { + vFIrqHandler(ulInterruptID); } } #endif diff --git a/third-party/freertos/tasks.c b/third-party/freertos/tasks.c index c56fe949..aa46398d 100644 --- a/third-party/freertos/tasks.c +++ b/third-party/freertos/tasks.c @@ -1998,7 +1998,6 @@ void vTaskStartScheduler(void) portCONFIGURE_TIMER_FOR_RUN_TIME_STATS(); /* Setting up the timer tick is hardware specific and thus in the portable interface. */ - if (xPortStartScheduler() != pdFALSE) { /* Should not reach here as if the scheduler is running the diff --git a/third-party/freertos/timers.c b/third-party/freertos/timers.c index a6df4c48..ab2f1069 100644 --- a/third-party/freertos/timers.c +++ b/third-party/freertos/timers.c @@ -504,7 +504,7 @@ static void prvTimerTask(void *pvParameters) /* Just to avoid compiler warnings. */ (void)pvParameters; - + #if (configUSE_DAEMON_TASK_STARTUP_HOOK == 1) { extern void vApplicationDaemonTaskStartupHook(void); diff --git a/third-party/lwip-2.1.2/Kconfig b/third-party/lwip-2.1.2/Kconfig index 55d80f8a..936a7e74 100644 --- a/third-party/lwip-2.1.2/Kconfig +++ b/third-party/lwip-2.1.2/Kconfig @@ -7,7 +7,7 @@ menu "LWIP Configuration" config LWIP_F_GMAC select USE_ETH - select ENABLE_F_GMAC + select ENABLE_FGMAC bool "F_GMAC" endchoice # LWIP_GMAC_CTRL_TYPE diff --git a/third-party/lwip-2.1.2/ports/f_gmac/ethernetif.c b/third-party/lwip-2.1.2/ports/f_gmac/ethernetif.c index 1a7884ec..b6bcc95c 100644 --- a/third-party/lwip-2.1.2/ports/f_gmac/ethernetif.c +++ b/third-party/lwip-2.1.2/ports/f_gmac/ethernetif.c @@ -43,11 +43,12 @@ #include "parameters.h" #include "ft_os_gmac.h" -#include "gmac.h" -#include "gmac_hw.h" -#include "phy_common.h" +#include "fgmac.h" +#include "fgmac_hw.h" +#include "fgmac_phy.h" #include "ft_assert.h" +#include "interrupt.h" #ifndef SDK_CONFIG_H__ #error "Please include sdkconfig.h first" @@ -57,8 +58,7 @@ #error "Please enable system tick by CONFIG_USE_SYS_TICK first" #endif #include "generic_timer.h" -#include "gmac.h" -#include "gmac_dma.h" +#include "fgmac.h" #include "ft_debug.h" /* The time to block waiting for input. */ @@ -77,6 +77,8 @@ #define ETHNETIF_DEBUG_E(format, ...) FT_DEBUG_PRINT_E(ETHNETIF_DEBUG_TAG, format, ##__VA_ARGS__) #define ETHNETIF_DEBUG_W(format, ...) FT_DEBUG_PRINT_W(ETHNETIF_DEBUG_TAG, format, ##__VA_ARGS__) +extern FError FGmacWritePhyReg(FGmacPhy *instance_p, u16 phy_reg, u32 phy_reg_val); +extern FError FGmacReadPhyReg(FGmacPhy *instance_p, u16 phy_reg, u32 *phy_reg_val_p); /** * Helper struct to hold private data used to operate your ethernet interface. @@ -86,52 +88,35 @@ */ struct ethernetif { struct eth_addr *ethaddr; - GmacCtrl *ethctrl; + FGmac *ethctrl; }; +static FGmac gctrl; /* huge size ctrl block */ +static FGmacPhy phy; -static GmacCtrl gctrl; /* huge size ctrl block */ static struct ethernetif netifctrl; /* align buf and descriptor by 128 */ -static u8 txBuf[GMAC_TX_DESCNUM * GMAC_MAX_PACKET_SIZE] __aligned(GMAC_DMA_MIN_ALIGN); -static u8 rxBuf[GMAC_RX_DESCNUM * GMAC_MAX_PACKET_SIZE] __aligned(GMAC_DMA_MIN_ALIGN); -static GmacDmaDesc txDesc[GMAC_TX_DESCNUM] __aligned(GMAC_DMA_MIN_ALIGN); -static GmacDmaDesc rxDesc[GMAC_RX_DESCNUM] __aligned(GMAC_DMA_MIN_ALIGN); +static u8 tx_buf[GMAC_TX_DESCNUM * GMAC_MAX_PACKET_SIZE] __aligned(GMAC_DMA_MIN_ALIGN); +static u8 rx_buf[GMAC_RX_DESCNUM * GMAC_MAX_PACKET_SIZE] __aligned(GMAC_DMA_MIN_ALIGN); +static FGmacDmaDesc tx_desc[GMAC_TX_DESCNUM] __aligned(GMAC_DMA_MIN_ALIGN); +static FGmacDmaDesc rx_desc[GMAC_RX_DESCNUM] __aligned(GMAC_DMA_MIN_ALIGN); /** * @name: eth_ctrl_init * @msg: config gmac and initialization * @return {*} - * @param {GmacCtrl} *pctrl + * @param {FGmac} *pctrl */ -static u32 eth_ctrl_init(GmacCtrl *pctrl) +u32 eth_ctrl_init(FGmac *pctrl) { LWIP_ASSERT("pctrl != NULL", (pctrl != NULL)); - u32 ret = GMAC_SUCCESS; - - memset(pctrl, 0U, sizeof(GmacCtrl)); - ret = GmacCfgInitialize(pctrl, GmacLookupConfig(GMAC_INSTANCE_0)); - LWIP_ERROR("eth_ctrl_init: init cfg failed\n", (GMAC_SUCCESS == ret), return ERR_IF); - - ret = GmacHwInitialize(pctrl); - LWIP_ERROR("eth_ctrl_init: init hardware failed\n", (GMAC_SUCCESS == ret), return ERR_IF); - - ret |= GmacDmaInitRxDescRing(pctrl, &rxDesc[0], &rxBuf[0], - GMAC_MAX_PACKET_SIZE, GMAC_RX_DESCNUM); - ret |= GmacDmaInitTxDescRing(pctrl, &txDesc[0], &txBuf[0], - GMAC_MAX_PACKET_SIZE, GMAC_TX_DESCNUM); - LWIP_ERROR("eth_ctrl_init: init hardware failed\n", (GMAC_SUCCESS == ret), return ERR_IF); - - ret = GmacIntrInit(pctrl); - LWIP_ERROR("eth_ctrl_init: init gmac intrrupt failed\n", (GMAC_SUCCESS == ret), return ERR_IF); - + u32 ret = FGMAC_SUCCESS; return ret; } void ethernet_link_thread(void *argument) { - EventBits_t ev; FtOsGmac *os_gmac_ptr = (FtOsGmac *)argument; struct netif *netif = &os_gmac_ptr->netif_object; @@ -140,16 +125,12 @@ void ethernet_link_thread(void *argument) for (;;) { - // printf("line=%d, ev=%#x, Flg=%d \r\n", __LINE__, ev, flag); ev = xEventGroupWaitBits(os_gmac_ptr->s_status_event, FT_NETIF_LINKUP | FT_NETIF_DOWN, pdTRUE, pdFALSE, portMAX_DELAY); - printf("line=%d, ev=%#x, Flg=%d \r\n", __LINE__, ev, flag); - if (ev & FT_NETIF_DOWN) { - // Ft_Os_Gmac_Stop(Os_GmacPtr); netif_set_link_down(netif); netif_set_down(netif); last_status = FT_NETIF_DOWN; @@ -163,12 +144,10 @@ void ethernet_link_thread(void *argument) } else { - ETHNETIF_DEBUG_I(" EventGroup is error \r\n"); + ETHNETIF_DEBUG_I("EventGroup is error \r\n"); FT_ASSERTVOIDALWAYS(); } - printf("ev=%#x, Flg=%d \r\n", ev, flag); - if (flag) { flag = 0; @@ -192,9 +171,7 @@ void GmacReceiveCallBack(void *args) { FtOsGmac *os_gmac_ptr; os_gmac_ptr = (FtOsGmac *)args; - //ETHNETIF_DEBUG_E(" Gmac_ReceiveCallBack \r\n"); xSemaphoreGiveFromISR(os_gmac_ptr->s_semaphore, 0); - } @@ -237,34 +214,36 @@ static void low_level_init(struct netif *netif) { u32 reg_value = 0; LWIP_ASSERT("netif != NULL", (netif != NULL)); - u32 ret = GMAC_SUCCESS; - - GmacCtrl *p_ctrl; - + u32 ret = FGMAC_SUCCESS; + FGmacMacAddr mac_addr; + FGmac *p_ctrl; FtOsGmac *os_gmac_ptr; os_gmac_ptr = container_of(netif, FtOsGmac, netif_object); - // GmacCtrl *p_ctrl; p_ctrl = &os_gmac_ptr->gmac; /* Init Gmac */ - FtOsGmacInit(os_gmac_ptr); + FtOsGmacInit(os_gmac_ptr, &phy); - /* Set Receive Callback */ - GmacRegisterEvtHandler(p_ctrl, GMAC_RX_COMPLETE_EVT, GmacReceiveCallBack); + /* Set Receive Callback */ + FGmacRegisterEvtHandler(p_ctrl, FGMAC_RX_COMPLETE_EVT, GmacReceiveCallBack); #if LWIP_ARP || LWIP_ETHERNET /* set MAC hardware address length */ netif->hwaddr_len = ETH_HWADDR_LEN; + /* set MAC hardware address */ + memset(mac_addr, 0, sizeof(mac_addr)); + FGmacGetMacAddr(os_gmac_ptr->gmac.config.base_addr, mac_addr); + /* set MAC hardware address */ - netif->hwaddr[0] = p_ctrl->config.macAddr[0]; - netif->hwaddr[1] = p_ctrl->config.macAddr[1]; - netif->hwaddr[2] = p_ctrl->config.macAddr[2]; - netif->hwaddr[3] = p_ctrl->config.macAddr[3]; - netif->hwaddr[4] = p_ctrl->config.macAddr[4]; - netif->hwaddr[5] = p_ctrl->config.macAddr[5]; + netif->hwaddr[0] = mac_addr[0]; + netif->hwaddr[1] = mac_addr[1]; + netif->hwaddr[2] = mac_addr[2]; + netif->hwaddr[3] = mac_addr[3]; + netif->hwaddr[4] = mac_addr[4]; + netif->hwaddr[5] = mac_addr[5]; /* maximum transfer unit */ netif->mtu = GMAC_MTU; @@ -284,22 +263,22 @@ static void low_level_init(struct netif *netif) os_gmac_ptr, os_gmac_ptr->config.mac_input_thread.priority, &os_gmac_ptr->config.mac_input_thread.thread_handle) != pdPASS) { - ETHNETIF_DEBUG_I("xTaskCreate is Error %s\r\n", os_gmac_ptr->config.mac_input_thread.thread_name); - FT_ASSERTVOIDALWAYS(); + ETHNETIF_DEBUG_I("xTaskCreate is Error %s\r\n", os_gmac_ptr->config.mac_input_thread.thread_name); + FT_ASSERTVOIDALWAYS(); } /* Enable MAC and DMA transmission and reception */ FtOsGmacStart(os_gmac_ptr); /* Read Register Configuration */ - GmacPhyReadReg(p_ctrl, PHY_INTERRUPT_ENABLE_OFFSET, ®_value); + FGmacReadPhyReg(&phy, PHY_INTERRUPT_ENABLE_OFFSET, ®_value); reg_value |= (PHY_INTERRUPT_ENABLE_LINK_FAIL); /* Enable Interrupt on change of link status */ - GmacPhyWriteReg(p_ctrl, PHY_INTERRUPT_ENABLE_OFFSET, reg_value); + FGmacWritePhyReg(&phy, PHY_INTERRUPT_ENABLE_OFFSET, reg_value); /* Read Register Configuration */ - GmacPhyReadReg(p_ctrl, PHY_INTERRUPT_ENABLE_OFFSET, ®_value); + FGmacReadPhyReg(&phy, PHY_INTERRUPT_ENABLE_OFFSET, ®_value); #endif /* LWIP_ARP || LWIP_ETHERNET */ @@ -334,18 +313,18 @@ static err_t low_level_output(struct netif *netif, struct pbuf *p) err_t errval; struct pbuf *q; u8 *buffer = NULL; - volatile GmacDmaDesc *dma_tx_desc; + volatile FGmacDmaDesc *dma_tx_desc; u32 frame_length = 0; u32 buffer_offset = 0; u32 bytes_left_to_copy = 0; u32 pay_load_offset = 0; - GmacCtrl *gmac; + FGmac *gmac; FtOsGmac *os_gmac; os_gmac = (FtOsGmac *)container_of(netif, FtOsGmac, netif_object); gmac = &os_gmac->gmac; - dma_tx_desc = &gmac->txDesc[gmac->txRing.descBufIdx]; - buffer = (u8 *)(intptr)(dma_tx_desc->buf1Addr); + dma_tx_desc = &gmac->tx_desc[gmac->tx_ring.desc_buf_idx]; + buffer = (u8 *)(intptr)(dma_tx_desc->buf_addr); if (buffer == NULL) { @@ -360,7 +339,7 @@ static err_t low_level_output(struct netif *netif, struct pbuf *p) for (q = p; q != NULL; q = q->next) { /* Is this buffer available? If not, goto error */ - if ((dma_tx_desc->status & GMAC_DMA_TDES0_OWN) != 0) + if ((dma_tx_desc->status & FGMAC_DMA_TDES0_OWN) != 0) { errval = ERR_USE; ETHNETIF_DEBUG_I("error errval = ERR_USE; \r\n"); @@ -377,19 +356,19 @@ static err_t low_level_output(struct netif *netif, struct pbuf *p) { /* Copy data to Tx buffer*/ memcpy((u8 *)((u8 *)buffer + buffer_offset), (u8 *)((u8 *)q->payload + pay_load_offset), (GMAC_MAX_PACKET_SIZE - buffer_offset)); - GMAC_DMA_INC_DESC(gmac->txRing.descBufIdx, gmac->txRing.descMaxNum); + FGMAC_DMA_INC_DESC(gmac->tx_ring.desc_buf_idx, gmac->tx_ring.desc_max_num); /* Point to next descriptor */ - dma_tx_desc = &gmac->txDesc[gmac->txRing.descBufIdx]; + dma_tx_desc = &gmac->tx_desc[gmac->tx_ring.desc_buf_idx]; /* Check if the Bufferis available */ - if ((dma_tx_desc->status & GMAC_DMA_TDES0_OWN) != (u32)0) + if ((dma_tx_desc->status & FGMAC_DMA_TDES0_OWN) != (u32)0) { errval = ERR_USE; ETHNETIF_DEBUG_I("Check if the Bufferis available \r\n"); goto error; } - buffer = (u8 *)(intptr)(dma_tx_desc->buf1Addr); + buffer = (u8 *)(intptr)(dma_tx_desc->buf_addr); bytes_left_to_copy = bytes_left_to_copy - (GMAC_MAX_PACKET_SIZE - buffer_offset); pay_load_offset = pay_load_offset + (GMAC_MAX_PACKET_SIZE - buffer_offset); frame_length = frame_length + (GMAC_MAX_PACKET_SIZE - buffer_offset); @@ -399,24 +378,25 @@ static err_t low_level_output(struct netif *netif, struct pbuf *p) { ETHNETIF_DEBUG_I(" error Buffer is 0 \r\n"); return ERR_VAL; - } + } } /* Copy the remaining bytes */ memcpy((u8 *)((u8 *)buffer + buffer_offset), (u8 *)((u8 *)q->payload + pay_load_offset), bytes_left_to_copy); buffer_offset = buffer_offset + bytes_left_to_copy; frame_length = frame_length + bytes_left_to_copy; - GMAC_DMA_INC_DESC(gmac->txRing.descBufIdx, gmac->txRing.descMaxNum); + FGMAC_DMA_INC_DESC(gmac->tx_ring.desc_buf_idx, gmac->tx_ring.desc_max_num); } #if ETH_PAD_SIZE pbuf_header(p, ETH_PAD_SIZE); /* reclaim the padding word */ #endif - GmacDmaTransFrame(gmac, frame_length); + FGmacSendFrame(gmac, frame_length); error: - GmacDmaResumeUnderflow(gmac); + FGmacResmuDmaUnderflow(gmac->config.base_addr); + return errval; } @@ -437,27 +417,27 @@ static struct pbuf *low_level_input(struct netif *netif) struct pbuf *q = NULL; u16 length = 0; u8 *buffer; - volatile GmacDmaDesc *dma_rx_desc; + volatile FGmacDmaDesc *dma_rx_desc; u32 buffer_offset = 0; u32 pay_load_offset = 0; u32 bytes_left_to_copy = 0; u32 desc_buffer_index; /* For Current Desc buffer buf position */ FtOsGmac *os_gmac; - GmacCtrl *gmac; + FGmac *gmac; os_gmac = (FtOsGmac *)container_of(netif, FtOsGmac, netif_object); gmac = &os_gmac->gmac; /* get received frame */ - if (GmacRingGetReceivedFrameIT(gmac) != FT_SUCCESS) + if (FGmacRecvFrame(gmac) != FT_SUCCESS) { return NULL; } - desc_buffer_index = gmac->rxRing.descBufIdx; - length = (gmac->rxDesc[desc_buffer_index].status & GMAC_DMA_RDES0_FRAME_LEN_MASK) >> GMAC_DMA_RDES0_FRAME_LEN_SHIFT; - buffer = (u8 *)(intptr)(gmac->rxDesc[desc_buffer_index].buf1Addr); + desc_buffer_index = gmac->rx_ring.desc_buf_idx; + length = (gmac->rx_desc[desc_buffer_index].status & FGMAC_DMA_RDES0_FRAME_LEN_MASK) >> FGMAC_DMA_RDES0_FRAME_LEN_SHIFT; + buffer = (u8 *)(intptr)(gmac->rx_desc[desc_buffer_index].buf_addr); #if ETH_PAD_SIZE @@ -479,7 +459,7 @@ static struct pbuf *low_level_input(struct netif *netif) #if ETH_PAD_SIZE pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */ #endif - dma_rx_desc = &gmac->rxDesc[desc_buffer_index]; + dma_rx_desc = &gmac->rx_desc[desc_buffer_index]; buffer_offset = 0; for (q = p; q != NULL; q = q->next) { @@ -492,14 +472,14 @@ static struct pbuf *low_level_input(struct netif *netif) memcpy((u8 *)((u8 *)q->payload + pay_load_offset), (u8 *)((u8 *)buffer + buffer_offset), (GMAC_MAX_PACKET_SIZE - buffer_offset)); /* Point to next descriptor */ - GMAC_DMA_INC_DESC(desc_buffer_index, gmac->rxRing.descMaxNum); - if (desc_buffer_index == gmac->rxRing.descIdx) + FGMAC_DMA_INC_DESC(desc_buffer_index, gmac->rx_ring.desc_max_num); + if (desc_buffer_index == gmac->rx_ring.desc_idx) { break; } - dma_rx_desc = &gmac->rxDesc[desc_buffer_index]; - buffer = (u8 *)(intptr)(dma_rx_desc->buf1Addr); + dma_rx_desc = &gmac->rx_desc[desc_buffer_index]; + buffer = (u8 *)(intptr)(dma_rx_desc->buf_addr); bytes_left_to_copy = bytes_left_to_copy - (GMAC_MAX_PACKET_SIZE - buffer_offset); pay_load_offset = pay_load_offset + (GMAC_MAX_PACKET_SIZE - buffer_offset); @@ -520,19 +500,18 @@ static struct pbuf *low_level_input(struct netif *netif) /* Release descriptors to DMA */ /* Point to first descriptor */ - dma_rx_desc = &gmac->rxDesc[desc_buffer_index]; + dma_rx_desc = &gmac->rx_desc[desc_buffer_index]; /* Set Own bit in Rx descriptors: gives the buffers back to DMA */ - for (desc_buffer_index = gmac->rxRing.descBufIdx; desc_buffer_index != gmac->rxRing.descIdx; GMAC_DMA_INC_DESC(desc_buffer_index, gmac->rxRing.descMaxNum)) + for (desc_buffer_index = gmac->rx_ring.desc_buf_idx; desc_buffer_index != gmac->rx_ring.desc_idx; FGMAC_DMA_INC_DESC(desc_buffer_index, gmac->rx_ring.desc_max_num)) { - dma_rx_desc->status |= GMAC_DMA_RDES0_OWN; - dma_rx_desc = &gmac->rxDesc[desc_buffer_index]; + dma_rx_desc->status |= FGMAC_DMA_RDES0_OWN; + dma_rx_desc = &gmac->rx_desc[desc_buffer_index]; } /* Sync index */ - gmac->rxRing.descBufIdx = gmac->rxRing.descIdx; - - GmacDmaResumeRecv(gmac); + gmac->rx_ring.desc_buf_idx = gmac->rx_ring.desc_idx; + FGmacResumeDmaRecv(gmac->config.base_addr); return p; } @@ -557,6 +536,7 @@ void ethernetif_input(void const *argument) if (xSemaphoreTake(os_gmac_ptr->s_semaphore, TIME_WAITING_FOR_INPUT) == pdTRUE) { + do { LOCK_TCPIP_CORE(); @@ -594,12 +574,7 @@ static err_t low_level_output_arp_off(struct netif *netif, struct pbuf *q, const err_t errval; errval = ERR_OK; -/* USER CODE BEGIN 5 */ - -/* USER CODE END 5 */ - return errval; - } #endif /* LWIP_ARP */ @@ -708,9 +683,9 @@ sio_fd_t sio_open(u8_t devnum) sio_fd_t sd; (void)devnum; - sd = 0; // dummy code + sd = 0; - return sd; + return sd; } /** @@ -731,7 +706,7 @@ u32_t sio_read(sio_fd_t fd, u8_t *data, u32_t len) (void)data; (void)fd; - recved_bytes = 0; // dummy code + recved_bytes = 0; return recved_bytes; } diff --git a/third-party/lwip-2.1.2/ports/f_gmac/ft_os_gmac.c b/third-party/lwip-2.1.2/ports/f_gmac/ft_os_gmac.c index 5842cc9f..68b5ba5d 100644 --- a/third-party/lwip-2.1.2/ports/f_gmac/ft_os_gmac.c +++ b/third-party/lwip-2.1.2/ports/f_gmac/ft_os_gmac.c @@ -15,12 +15,11 @@ #include #include #include - #include #include #include "ft_os_gmac.h" -#include "gmac.h" +#include "fgmac.h" #include "ft_assert.h" #include "ft_io.h" #include "ft_assert.h" @@ -37,6 +36,188 @@ #define FT_OS_GMACOBJECT_READLY 0x58 +static boolean rx_data_flag = FALSE; + +static void EthLinkPhyStatusChecker(void *param) +{ + FT_ASSERTVOID(param != NULL); + FGmac *instance_p = (FGmac *)param; + uintptr base_addr = instance_p->config.base_addr; + + u32 phy_status = FGMAC_READ_REG32(base_addr, FGMAC_MAC_PHY_STATUS); + + if (FGMAC_RGSMIIIS_LNKSTS_UP == (FGMAC_RGSMIIIS_LNKSTS & phy_status)) + { + OS_MAC_DEBUG_I("link is up"); + } + else + { + OS_MAC_DEBUG_I("link is down"); + } + + return; +} + +static void EthLinkDmaErrChecker(void *param) +{ + FT_ASSERTVOID(param != NULL); + FGmac *instance_p = (FGmac *)param; + uintptr base_addr = instance_p->config.base_addr; + + u32 reg_val = FGMAC_READ_REG32(base_addr, FGMAC_DMA_INTR_OFFSET); + u32 status = FGMAC_READ_REG32(base_addr, FGMAC_DMA_STATUS_OFFSET); + + if ((FGMAC_DMA_STATUS_TPS & status) && (FGMAC_DMA_INTR_ENA_TSE & reg_val)) + { + OS_MAC_DEBUG_E("Transmit process stopped"); + } + + if ((FGMAC_DMA_STATUS_TU & status) && (FGMAC_DMA_INTR_ENA_TUE & reg_val)) + { + OS_MAC_DEBUG_E("Transmit Buffer Unavailable"); + } + + if ((FGMAC_DMA_STATUS_TJT & status) && (FGMAC_DMA_INTR_ENA_THE & reg_val)) + { + OS_MAC_DEBUG_E("Transmit Jabber Timeout"); + } + + if ((FGMAC_DMA_STATUS_OVF & status) && (FGMAC_DMA_INTR_ENA_OVE & reg_val)) + { + OS_MAC_DEBUG_E("Receive Overflow"); + } + + if ((FGMAC_DMA_STATUS_UNF & status) && (FGMAC_DMA_INTR_ENA_UNE & reg_val)) + { + OS_MAC_DEBUG_E("Transmit Underflow"); + } + + if ((FGMAC_DMA_STATUS_RU & status) && (FGMAC_DMA_INTR_ENA_RUE & reg_val)) + { + OS_MAC_DEBUG_E("Receive Buffer Unavailable"); + } + + if ((FGMAC_DMA_STATUS_RPS & status) && (FGMAC_DMA_INTR_ENA_RSE & reg_val)) + { + OS_MAC_DEBUG_E("Receive Process Stopped"); + } + + if ((FGMAC_DMA_STATUS_RWT & status) && (FGMAC_DMA_INTR_ENA_RWE & reg_val)) + { + OS_MAC_DEBUG_E("Receive Watchdog Timeout"); + } + + if ((FGMAC_DMA_STATUS_ETI & status) && (FGMAC_DMA_INTR_ENA_ETE & reg_val)) + { + OS_MAC_DEBUG_E("Early Transmit Interrupt"); + } + + if ((FGMAC_DMA_STATUS_FBI & status) && (FGMAC_DMA_INTR_ENA_FBE & reg_val)) + { + OS_MAC_DEBUG_E("Fatal Bus Error"); + } + + return; +} + +void EthLinkStatusChecker(void *param) +{ + FT_ASSERTVOID(param); + FGmac *instance_p = (FGmac *)param; + uintptr base_addr = instance_p->config.base_addr; + u32 status = FGMAC_READ_REG32(base_addr, FGMAC_MAC_PHY_STATUS); + u32 speed_status, duplex_status; + u32 speed, duplex; + + /* Check the link status */ + if (FGMAC_RGSMIIIS_LNKSTS_UP == (FGMAC_RGSMIIIS_LNKSTS & status)) + { + speed_status = FGMAC_RGSMIIIS_SPEED & status; + duplex_status = FGMAC_RGSMIIIS_LNKMODE & status; + + if (FGMAC_RGSMIIIS_SPEED_125MHZ == speed_status) + speed = FGMAC_PHY_SPEED_1000; + else if (FGMAC_RGSMIIIS_SPEED_25MHZ == speed_status) + speed = FGMAC_PHY_SPEED_100; + else + speed = FGMAC_PHY_SPEED_10; + + if (FGMAC_RGSMIIIS_LNKMODE_HALF == duplex_status) + duplex = FGMAC_PHY_MODE_HALFDUPLEX; + else + duplex = FGMAC_PHY_MODE_FULLDUPLEX; + + OS_MAC_DEBUG_I("link is up --- %d/%s", + speed, (FGMAC_PHY_MODE_FULLDUPLEX == duplex) ? "full" : "half"); + } + else + { + OS_MAC_DEBUG_I("link is down"); + } + + (void)speed; + (void)duplex; +} + +static void EthLinkRecvDoneCallback(void *param) +{ + FT_ASSERTVOID(param); + FGmac *instance_p = (FGmac *)param; + + if (TRUE == rx_data_flag) + { + OS_MAC_DEBUG_W("last rx data has not been handled !!!"); + } + + rx_data_flag = TRUE; + OS_MAC_DEBUG_I("recv data"); + return; +} + +static void EthLinkTransDoneCallback(void *param) +{ + FT_ASSERTVOID(param); + FGmac *instance_p = (FGmac *)param; + + FGmacResumeDmaSend(instance_p->config.base_addr); + OS_MAC_DEBUG_I("resume trans"); + return; +} + +int FtOsGmacSetupInterrupt(FGmac *instance_p) +{ + LWIP_ASSERT("instance_p != NULL", (instance_p != NULL)); + FGmacConfig *config_p = &instance_p->config; + uintptr base_addr = config_p->base_addr; + u32 irq_num = config_p->irq_num; + u32 irq_priority = (0x8 << 4) + 4 * 16; + + /* disable all gmac & dma intr */ + FGmacSetInterruptMask(instance_p, FGMAC_CTRL_INTR, FGMAC_ISR_MASK_ALL_BITS, FALSE); + FGmacSetInterruptMask(instance_p, FGMAC_DMA_INTR, FGMAC_DMA_INTR_ENA_ALL_MASK, FALSE); + + InterruptSetPriority(irq_num, irq_priority); + InterruptInstall(irq_num, FGmacInterruptHandler, instance_p, "GMAC-IRQ"); + + /* register intr callback */ + FGmacRegisterEvtHandler(instance_p, FGMAC_PHY_STATUS_EVT, EthLinkPhyStatusChecker); + FGmacRegisterEvtHandler(instance_p, FGMAC_DMA_ERR_EVT, EthLinkDmaErrChecker); + FGmacRegisterEvtHandler(instance_p, FGMAC_LINK_STATUS_EVT, EthLinkStatusChecker); + FGmacRegisterEvtHandler(instance_p, FGMAC_TX_COMPLETE_EVT, EthLinkTransDoneCallback); + + /* umask intr */ + InterruptUmask(irq_num); + + /* enable some interrupts */ + FGmacSetInterruptMask(instance_p, FGMAC_CTRL_INTR, FGMAC_ISR_MASK_RSIM, TRUE); + FGmacSetInterruptMask(instance_p, FGMAC_DMA_INTR, FGMAC_DMA_INTR_ENA_NIE | FGMAC_DMA_INTR_ENA_RIE\ + /*FGMAC_DMA_INTR_ENA_ALL_MASK*/, TRUE); + + OS_MAC_DEBUG_I("gmac setup done"); + return 0; +} + + /** * @name: Ft_Os_GmacMem_Create * @msg: Initialize the Gmac TX/Rx Describe Memory 。 @@ -46,11 +227,12 @@ static u8 rx_buf[GMAC_RX_DESCNUM * GMAC_MAX_PACKET_SIZE] __attribute__((aligned(32))); static u8 tx_buf[GMAC_TX_DESCNUM * GMAC_MAX_PACKET_SIZE] __attribute__((aligned(32))); -static u8 tx_desc[GMAC_TX_DESCNUM * sizeof(GmacDmaDesc)] __attribute__((aligned(128))); -static u8 rx_desc[GMAC_RX_DESCNUM * sizeof(GmacDmaDesc) + 128] __attribute__((aligned(128))); +static u8 tx_desc[GMAC_TX_DESCNUM * sizeof(FGmacDmaDesc)] __attribute__((aligned(128))); +static u8 rx_desc[GMAC_RX_DESCNUM * sizeof(FGmacDmaDesc) + 128] __attribute__((aligned(128))); static void FtOsGmacMemCreate(FtOsGmac *os_gmac) { + FT_ASSERTVOID(os_gmac != NULL); os_gmac->rx_buffer = rx_buf; if (os_gmac->rx_buffer == NULL) { @@ -65,28 +247,29 @@ static void FtOsGmacMemCreate(FtOsGmac *os_gmac) FT_ASSERTVOIDALWAYS(); } - os_gmac->gmac.txDesc = (GmacDmaDesc *)tx_desc; - if (os_gmac->gmac.txDesc == NULL) + os_gmac->gmac.tx_desc = (FGmacDmaDesc *)tx_desc; + if (os_gmac->gmac.tx_desc == NULL) { - OS_MAC_DEBUG_E("txDesc Malloc is error "); + OS_MAC_DEBUG_E("tx_desc Malloc is error "); FT_ASSERTVOIDALWAYS(); } - os_gmac->gmac.rxDesc = (GmacDmaDesc *)rx_desc; - if (os_gmac->gmac.rxDesc == NULL) + os_gmac->gmac.rx_desc = (FGmacDmaDesc *)rx_desc; + if (os_gmac->gmac.rx_desc == NULL) { - OS_MAC_DEBUG_E("rxDesc Malloc is error "); + OS_MAC_DEBUG_E("rx_desc Malloc is error "); FT_ASSERTVOIDALWAYS(); } #define ROUND_UP(x, align) (((long)(x) + ((long)align - 1)) & \ ~((long)align - 1)) - os_gmac->gmac.rxDesc = (GmacDmaDesc *)ROUND_UP(os_gmac->gmac.rxDesc, 128); + os_gmac->gmac.rx_desc = (FGmacDmaDesc *)ROUND_UP(os_gmac->gmac.rx_desc, 128); } static void FtOsGmacMemFree(FtOsGmac *os_gmac) { + FT_ASSERTVOID(os_gmac != NULL); if (os_gmac->rx_buffer) { vPortFree(os_gmac->rx_buffer); @@ -97,14 +280,14 @@ static void FtOsGmacMemFree(FtOsGmac *os_gmac) vPortFree(os_gmac->tx_buffer); } - if (os_gmac->gmac.rxDesc) + if (os_gmac->gmac.rx_desc) { - vPortFree((void *)(os_gmac->gmac.rxDesc)); + vPortFree((void *)(os_gmac->gmac.rx_desc)); } - if (os_gmac->gmac.txDesc) + if (os_gmac->gmac.tx_desc) { - vPortFree((void *)(os_gmac->gmac.txDesc)); + vPortFree((void *)(os_gmac->gmac.tx_desc)); } } @@ -131,19 +314,27 @@ void FtOsGmacObjectInit(FtOsGmac *os_gmac, FtOsGmacConfig *config) * @param {u32} InstanceId * @return {*} */ -void FtOsGmacInit(FtOsGmac *os_gmac) + +void FtOsGmacInit(FtOsGmac *os_gmac, FGmacPhy *phy_p) { - GmacCtrl *gmac; FT_ASSERTVOID(os_gmac != NULL); - + FT_ASSERTVOID(phy_p != NULL); FT_ASSERTVOID((os_gmac->is_ready == FT_OS_GMACOBJECT_READLY)); + FGmac *gmac; gmac = &os_gmac->gmac; FtOsGmacMemFree(os_gmac); - FT_ASSERTVOID(GmacCfgInitialize(gmac, GmacLookupConfig(os_gmac->config.gmac_instance)) == FT_SUCCESS); + + FT_ASSERTVOID(FGmacCfgInitialize(gmac, FGmacLookupConfig(gmac->config.instance_id)) == FT_SUCCESS); + FtOsGmacMemCreate(os_gmac); + /* initialize phy */ + memset(phy_p, 0U, sizeof(FGmacPhy)); + FGmacPhyLookupConfig(gmac->config.instance_id, phy_p); + FT_ASSERTVOID(FGmacPhyCfgInitialize(phy_p) == FT_SUCCESS); + /* Create a binary semaphore used for informing ethernetif of frame reception */ FT_ASSERTVOID((os_gmac->s_semaphore = xSemaphoreCreateBinary()) != NULL); /* Create a event group used for ethernetif of status change */ @@ -156,15 +347,16 @@ void FtOsGmacInit(FtOsGmac *os_gmac) * @param {Ft_Os_Gmac} *Os_Gmac * @return {*} */ + void FtOsGmacStart(FtOsGmac *os_gmac) { - GmacCtrl *gmac; FT_ASSERTVOID(os_gmac != NULL); FT_ASSERTVOID((os_gmac->is_ready == FT_OS_GMACOBJECT_READLY)); + + FGmac *gmac; gmac = &os_gmac->gmac; - u32 ret; + u32 ret = FT_SUCCESS; - ret = GmacHwInitialize(gmac); if (FT_SUCCESS != ret) { OS_MAC_DEBUG_E("gmac return err code %d\r\n", ret); @@ -172,22 +364,23 @@ void FtOsGmacStart(FtOsGmac *os_gmac) } /* Initialize Rx Description list : ring Mode */ - GmacDmaInitRxDescRing(gmac, (GmacDmaDesc *)(gmac->rxDesc), os_gmac->rx_buffer, GMAC_MAX_PACKET_SIZE, GMAC_RX_DESCNUM); + FGmacSetupRxDescRing(gmac, (FGmacDmaDesc *)(gmac->rx_desc), os_gmac->rx_buffer, GMAC_MAX_PACKET_SIZE, GMAC_RX_DESCNUM); /* Initialize Tx Description list : ring Mode */ - GmacDmaInitTxDescRing(gmac, (GmacDmaDesc *)(gmac->txDesc), os_gmac->tx_buffer, GMAC_MAX_PACKET_SIZE, GMAC_TX_DESCNUM); + FGmacSetupTxDescRing(gmac, (FGmacDmaDesc *)(gmac->tx_desc), os_gmac->tx_buffer, GMAC_MAX_PACKET_SIZE, GMAC_TX_DESCNUM); - GmacDmaStart(gmac); + /* enable gmac */ + FGmacStartTrans(gmac); /* Gmac interrupt init */ - GmacIntrInit(gmac); + FtOsGmacSetupInterrupt(gmac); return; } void FtOsGmacStop(FtOsGmac *os_gmac) { - GmacCtrl *gmac; + FGmac *gmac; FT_ASSERTVOID(os_gmac != NULL); FT_ASSERTVOID((os_gmac->is_ready == FT_OS_GMACOBJECT_READLY)); diff --git a/third-party/lwip-2.1.2/ports/f_gmac/ft_os_gmac.h b/third-party/lwip-2.1.2/ports/f_gmac/ft_os_gmac.h index 0143f1f2..aade7877 100644 --- a/third-party/lwip-2.1.2/ports/f_gmac/ft_os_gmac.h +++ b/third-party/lwip-2.1.2/ports/f_gmac/ft_os_gmac.h @@ -19,7 +19,9 @@ #include #include -#include "gmac.h" +#include "fgmac.h" +#include "fgmac_hw.h" +#include "fgmac_phy.h" #include "parameters.h" #include "lwip/netif.h" @@ -36,6 +38,11 @@ #define GMAC_RX_DESCNUM 1024U #define GMAC_TX_DESCNUM 1024U +#define GMAC_MTU 1500U + +/* Common PHY Registers (AR8035) */ +#define PHY_INTERRUPT_ENABLE_OFFSET ((u16)0x12) +#define PHY_INTERRUPT_ENABLE_LINK_FAIL 0x00000800U /* Link fail interrupt, 0 Interrupt disable , 1 Interrupt enable */ struct Ipv4Address { @@ -63,7 +70,7 @@ typedef struct typedef struct { - GmacCtrl gmac; + FGmac gmac; struct netif netif_object; FtOsGmacConfig config; u8 *rx_buffer; /* Buffer for RxDesc */ @@ -73,9 +80,9 @@ typedef struct EventGroupHandle_t s_status_event; /* Event Group to show netif's status ,follow FT_NETIF_XX*/ } FtOsGmac; void FtOsGmacObjectInit(FtOsGmac *os_gmac, FtOsGmacConfig *config); -void FtOsGmacInit(FtOsGmac *os_gmac); +void FtOsGmacInit(FtOsGmac *os_gmac, FGmacPhy *phy_p); void FtOsGmacStart(FtOsGmac *os_gmac); void FtOsGmacStop(FtOsGmac *os_gmac); - +int FtOsGmacSetupInterrupt(FGmac *instance_p); #endif // ! FT_OS_GMAC_H diff --git a/third-party/third-party.mk b/third-party/third-party.mk index 0f6ea5e2..e7bb1837 100644 --- a/third-party/third-party.mk +++ b/third-party/third-party.mk @@ -37,7 +37,7 @@ INC_DIR += $(THIRD_PARTY_CUR_DIR)/lwip-2.1.2/include \ $(THIRD_PARTY_CUR_DIR)/lwip-2.1.2/include/netif # src code of ports -ifdef CONFIG_ENABLE_F_GMAC +ifdef CONFIG_ENABLE_FGMAC INC_DIR += $(THIRD_PARTY_CUR_DIR)/lwip-2.1.2/ports/f_gmac \ $(THIRD_PARTY_CUR_DIR)/lwip-2.1.2/ports/f_gmac/arch -- Gitee