From 1e79c2a6f6132fe859029b82692faad827b260f2 Mon Sep 17 00:00:00 2001 From: zhugengyu Date: Tue, 19 Oct 2021 06:24:33 +0000 Subject: [PATCH] =?UTF-8?q?!31=20=E6=94=AF=E6=8C=81newlibc=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9sdk=E5=BC=80=E5=8F=91=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E6=96=B9=E6=B3=95=20Merge=20pull=20request?= =?UTF-8?q?=20!31=20from=20zhugengyu/newlibc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Kconfig | 2 +- README.md | 375 +++++++----------- baremetal/example/can_test/sdkconfig | 4 +- baremetal/example/can_test/sdkconfig.h | 4 +- baremetal/example/gdma_test/sdkconfig | 4 +- baremetal/example/gdma_test/sdkconfig.h | 4 +- baremetal/example/letter_shell_test/sdkconfig | 2 +- .../configs/d2000_amp_core0_aarch32_defconfig | 2 +- .../configs/d2000_amp_core0_aarch64_defconfig | 2 +- .../configs/d2000_amp_core1_aarch32_defconfig | 2 +- .../configs/d2000_amp_core1_aarch64_defconfig | 2 +- .../example/libmetal_test/core0/sdkconfig | 2 +- .../example/libmetal_test/core0/sdkconfig.h | 2 +- .../example/libmetal_test/core1/sdkconfig | 2 +- .../example/libmetal_test/core1/sdkconfig.h | 2 +- baremetal/example/lwip_test/sdkconfig | 4 +- baremetal/example/lwip_test/sdkconfig.h | 4 +- baremetal/example/nand_flash_test/sdkconfig | 4 +- baremetal/example/nand_flash_test/sdkconfig.h | 2 +- baremetal/example/newlibc_test/Kconfig | 11 + baremetal/example/newlibc_test/README.md | 81 ++++ baremetal/example/newlibc_test/main.c | 20 + baremetal/example/newlibc_test/makefile | 26 ++ baremetal/example/newlibc_test/sdkconfig | 106 +++++ baremetal/example/newlibc_test/sdkconfig.h | 97 +++++ baremetal/example/overall_test/sdkconfig | 4 +- baremetal/example/overall_test/sdkconfig.h | 4 +- baremetal/example/pcie_test/sdkconfig | 4 +- baremetal/example/pcie_test/sdkconfig.h | 4 +- baremetal/example/qspi_nor_flash/sdkconfig | 4 +- baremetal/example/qspi_nor_flash/sdkconfig.h | 4 +- baremetal/example/spi_test/sdkconfig | 4 +- baremetal/example/spi_test/sdkconfig.h | 4 +- baremetal/example/template-mingw64/makefile | 6 +- baremetal/example/template-mingw64/sdkconfig | 4 +- .../example/template-mingw64/sdkconfig.h | 4 +- baremetal/example/template/makefile | 7 +- baremetal/example/template/sdkconfig | 4 +- baremetal/example/template/sdkconfig.h | 4 +- baremetal/example/timer_tacho/sdkconfig | 4 +- baremetal/example/timer_tacho/sdkconfig.h | 4 +- baremetal/example/uart_test/sdkconfig | 4 +- baremetal/example/uart_test/sdkconfig.h | 4 +- baremetal/example/wdt_test/sdkconfig | 4 +- baremetal/example/wdt_test/sdkconfig.h | 4 +- baremetal/example/xmac_test/sdkconfig | 4 +- baremetal/example/xmac_test/sdkconfig.h | 4 +- board/d2000/early_uart.c | 10 +- board/d2000/early_uart.h | 30 +- common/Kconfig | 12 - configs/d2000_aarch32_amp_master_defconfig | 4 +- configs/d2000_aarch32_amp_slave_defconfig | 4 +- configs/d2000_aarch32_defconfig | 4 +- configs/d2000_aarch64_defconfig | 4 +- configs/e2000_aarch32_defconfig | 4 +- configs/e2000_aarch64_defconfig | 4 +- configs/ft2004_aarch32_defconfig | 4 +- configs/ft2004_aarch64_defconfig | 4 +- doc/ChangeLog.md | 16 + install.py | 132 +++--- lib/Kconfig | 15 +- lib/lib.mk | 15 +- make/complier.mk | 79 ++-- make/ld/Kconfig | 2 +- run_mingw64.cmd | 2 - run_tftd.cmd | 2 - scripts/compress.md | 5 +- scripts/update_dev_path.sh | 27 ++ third-party/Kconfig | 2 +- 69 files changed, 758 insertions(+), 482 deletions(-) create mode 100644 baremetal/example/newlibc_test/Kconfig create mode 100644 baremetal/example/newlibc_test/README.md create mode 100644 baremetal/example/newlibc_test/main.c create mode 100644 baremetal/example/newlibc_test/makefile create mode 100644 baremetal/example/newlibc_test/sdkconfig create mode 100644 baremetal/example/newlibc_test/sdkconfig.h delete mode 100644 run_mingw64.cmd delete mode 100644 run_tftd.cmd create mode 100644 scripts/update_dev_path.sh diff --git a/Kconfig b/Kconfig index a727b708e..139e79d35 100644 --- a/Kconfig +++ b/Kconfig @@ -3,7 +3,7 @@ STANDALONE_DIR := $(STANDALONE_SDK_ROOT) -menu "Board Setting" +menu "Platform Setting" source "$(STANDALONE_DIR)/arch/Kconfig" source "$(STANDALONE_DIR)/board/Kconfig" source "$(STANDALONE_DIR)/drivers/Kconfig" diff --git a/README.md b/README.md index 58bb521ae..6c21b5d17 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Phytium-Standalone-SDK -**v0.1.5** [ReleaseNote](./doc/ChangeLog.md) +**v0.1.6** [ReleaseNote](./doc/ChangeLog.md) --- @@ -12,259 +12,154 @@ --- -## 2. 安装使用 +## 2. 安装方法 -### 2.1 Windows 10 x86_64 环境下使用 Standalone SDK +### 2.1 获取SDK的开发环境 -#### 2.1.1 在线安装`Msys2`搭建开发环境 +- 按照不同开发平台获取DEV压缩包 -> 如果不想安装,可以参考 2.1.2 使用已经安装好的Portable开发环境 +- [Windows10](https://pan.baidu.com/s/1i7rkUPzXwhbyasbhlUKPmQ) +>提取码:WX64 -##### 2.1.1.1 准备安装包 +- [Ubuntu 20.04 x86_64](https://pan.baidu.com/s/1GrXHCygjcySKxARQ5UduTA ) +>提取码:LX64 +![linux-x86_64](https://images.gitee.com/uploads/images/2021/1019/095533_a960e2a6_8736513.png "linux-x86_64.png") -1. 获取[Windows环境安装包](https://pan.baidu.com/s/17WX5hec7t8_ubAKzFCwQAA) +- [Ubuntu/Kylis OS aarch64](https://pan.baidu.com/s/1pDWZIdI-dRle4NOIsP-TQA ) +>提取码:LA64 -> 提取码:MGW6 +![linux-aarch64](https://images.gitee.com/uploads/images/2021/1019/101040_ff6c194e_8736513.png "linux-aarch64.png") -- msys2, `msys2-x86_64-20210725.exe` -- mingw64-arm交叉编译链, `gcc-arm-10.3-2021.07-mingw-w64-i686-arm-none-eabi.tar.xz`, `gcc-arm-10.3-2021.07-mingw-w64-i686-aarch64-none-elf.tar.xz` -- tftp工具,`tftp.zip` +Q:如何解压SDK开发环境压缩包 +> Windows环境下可以用通用的unzip工具解压,如7zip和winrar -##### 2.1.1.2 配置开发环境目录 +> Linux/KylinOS环境下可以用unzip命令解压 -1. 创建Windows集成开发环境(DEV目录),如`D:/phytium-dev`, 将DEV目录添加在Windows环境变量中,变量名为`PHYTIUM_DEV_PATH`,如下图所示,保存环境变量, +### 2.2 安装SDK开发环境 -> 对于Windows 10,在桌面左下角系统搜索框中输入“环境变量”即可进入环境变量编辑界面 +> 对于Windows 10平台,2.1章节的开发环境压缩包中通过msys2控制台提供了git工具 -> DEV目录中不要留空格 +> 对于Linux/KylinOS平台,可以通过`sudo apt-get install build-essential`安装git等工具 -![输入图片说明](https://images.gitee.com/uploads/images/2021/1013/192453_4e609b79_8736513.png "配置环境变量.png") +#### 2.2.1 Windows 10 -2. 保存DEV环境变量后,打开一个控制台,输入`echo %PHYTIUM_DEV_PATH%`,检查环境变量是否设置成功, +- Windows10下使用SDK依赖Msys2, 推荐使用2.1章提供的开发环境, 也可以参考2.3章手动安装Msys2 +- (1). 添加Windows环境变量,`PHYTIUM_DEV_PATH`(环境变量名**不能自定义**),例如,指向文件夹`E:\phytium-dev-windows-nt`(可以自定义) -![输入图片说明](https://images.gitee.com/uploads/images/2021/1013/164646_3fbc5df8_8736513.png "检查环境变量.png") +![配置环境变量](https://images.gitee.com/uploads/images/2021/1019/105259_18e64169_8736513.png "配置环境变量.png") -##### 2.1.1.3 安装`Msys2`到开发环境中 +- (2). 进入DEV目录,双击脚本`run_msys2.cmd`, 进入msys2控制台, 运行`source ./update_sdk_dev.sh`,安装开发环境 -1. 双击`msys2-x86_64-20210725.exe`,设置`Msys2`的安装路径在DEV路径下,其余设置按默认安装,注意安装完成后不要马上启动,最后一步取消勾选“马上启动Msys2” +![安装开发环境](https://images.gitee.com/uploads/images/2021/1019/105848_f49f8f72_8736513.png "安装开发环境.png") -![输入图片说明](https://images.gitee.com/uploads/images/2021/1013/164805_4169d4d2_8736513.png "安装Msys2.png") +![开发环境安装完成](https://images.gitee.com/uploads/images/2021/1019/110311_eeb15589_8736513.png "开发环境安装完成.png") -![Msys2安装过程](https://images.gitee.com/uploads/images/2021/1013/135101_c8fc0454_8736513.png "Msys2安装过程.png") +#### 2.2.2 Kylin OS/Ubuntu 20.04 -2. `Msys2`安装完成后,需要添加国内软件源,否则下载速度会很慢,进入`D:\phytium-dev\msys64\etc\pacman.d`目录下,找到以下三个文件,在文件末尾分别添加对应的软件源 +- (1). 解压开发环境压缩包,形成DEV目录 -- mirrorlist.mingw32 -``` -Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/i686 -``` +![解压DEV](https://images.gitee.com/uploads/images/2021/1019/110732_609695c3_8736513.png "解压DEV.png") -- mirrorlist.mingw64 -``` -Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/x86_64 -``` +- (2). 进入DEV目录,运行`source ./update_sdk_dev.sh`,安装开发环境 -- mirrorlist.msys -``` -Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/$arch -``` +![安装开发环境](https://images.gitee.com/uploads/images/2021/1019/110951_4ce01ea1_8736513.png "安装开发环境.png") -3. 进入`D:\phytium-dev\msys64`目录,双击`msys2_shell.cmd`启动运行`Msys2`,输入以下命令,更新`Msys2`软件,安装必要组件 +![安装完成](https://images.gitee.com/uploads/images/2021/1019/111228_e0c5ea48_8736513.png "安装完成.png") -> 如果执行失败,可以多次尝试,直到没有报错 +#### 2.2.3 检查安装是否成功 -> 安装过程全部选用默认方式`default`或选择`y`,注意如果没有`default = all`,需要输入`y` +- 打印下列环境变量,观察各变量是否存在,指向的目录是否正确 +> `PHYTIUM_DEV_PATH`指向DEV目录 -``` -$ pacman -Syu -$ pacman -S mingw-w64-x86_64-toolchain -$ pacman -S base-devel git python3 python3-pip -``` - -![更新Msys2软件源](https://images.gitee.com/uploads/images/2021/1013/140545_6cda8ecc_8736513.png "更新Msys2软件源.png") - -4. 运行以下命令,检查组件是否安装完全 -``` -$ pacman -Q make git wget python3 python3-pip -``` +> `STANDALONE_SDK_ROOT`指向SDK源文件目录 -##### 2.1.1.4 安装SDK和交叉编译链 +> `AARCH32_CROSS_PATH`指向32位交叉编译链目录 -- 通过 Gitee 拉取 Standalone SDK 源代码到DEV目录下,如`D:\PHYTIUM-DEV\phytium-standalone-sdk` +> `AARCH64_CROSS_PATH`指向64位交叉编译链目录 ``` -$ git clone https://gitee.com/phytium_embedded/phytium-standalone-sdk.git - ./phytium-standalone-sdk -$ cd ./phytium-standalone-sdk +echo $PHYTIUM_DEV_PATH $STANDALONE_SDK_ROOT $AARCH32_CROSS_PATH $AARCH64_CROSS_PATH ``` +![检查环境变量](https://images.gitee.com/uploads/images/2021/1019/111414_f7639144_8736513.png "检查环境变量.png") -- 将交叉编译链压缩包`gcc-arm-10.3-2021.07-mingw-w64-i686-arm-none-eabi.tar.xz`, `gcc-arm-10.3-2021.07-mingw-w64-i686-aarch64-none-elf.tar.xz`放置在`D:\PHYTIUM-DEV\phytium-standalone-sdk\tools`下 - -- 创建SDK的profile文件,并添加读写权限 -``` -$ touch /etc/profile.d/phytium_standalone_sdk.sh -$ chmod 666 /etc/profile.d/phytium_standalone_sdk.sh -``` - -- 在`D:\phytium-dev\phytium-standalone-sdk`目录下通过`Msys2`运行`./install.py` - -> 如果出现安装成功信息`[5]: Success!!!`表示安装成功,否则根据相应提示信息排查错误 - -> Windows环境不支持使用在线安装,即不支持使用`./install.py -online` - -![检查安装需要的组件](https://images.gitee.com/uploads/images/2021/1014/153121_815cdc26_8736513.png "检查安装需要的组件.png") +### 2.3 Windows 10安装Msys2(可选) -![SDK安装过程](https://images.gitee.com/uploads/images/2021/1014/153155_ccaba2ab_8736513.png "SDK安装过程.png") +- (1). 获取[Windows环境安装包](https://pan.baidu.com/s/17WX5hec7t8_ubAKzFCwQAA) -![SDK安装完成](https://images.gitee.com/uploads/images/2021/1014/153529_929928b2_8736513.png "SDK安装完成.png") - -- **安装完成后重启系统,生效 Standalone SDK 环境**, 检查SDK路径是否与环境变量`STANDALONE_SDK_ROOT`一致 - -![SDK安装完成环境变量](https://images.gitee.com/uploads/images/2021/1014/153641_9ceb3358_8736513.png "SDK安装完成环境变量.png") - -#### 2.1.2 使用Portable的开发环境 - -- 下载开发环境然后解压,如`D:\PHYTIUM-DEV` - -[下载链接](https://pan.baidu.com/s/1rF0fh4RwgiIpuTI0pk47xg) > 提取码:MGW6 -- 添加Windows环境变量,`PHYTIUM_DEV_PATH`(环境变量名不能自定义,必须用这个名字,SDK内部会使用)指向`D:\PHYTIUM-DEV`(可以自定义) - -![输入图片说明](https://images.gitee.com/uploads/images/2021/1013/164551_934da3d7_8736513.png "配置环境变量.png") - -- 通过 Gitee 拉取 Standalone SDK 源代码到DEV目录下的`D:\PHYTIUM-DEV\phytium-standalone-sdk` - -``` -$ git clone https://gitee.com/phytium_embedded/phytium-standalone-sdk.git ./phytium-standalone-sdk -$ cd ./phytium-standalone-sdk -``` - -- 将交叉编译链压缩包`gcc-arm-10.3-2021.07-mingw-w64-i686-arm-none-eabi.tar.xz`, `gcc-arm-10.3-2021.07-mingw-w64-i686-aarch64-none-elf.tar.xz`放置在`D:\PHYTIUM-DEV\phytium-standalone-sdk\tools`下 +- msys2, `msys2-x86_64-20210725.exe` +- mingw64-arm交叉编译链, `gcc-arm-10.3-2021.07-mingw-w64-i686-arm-none-eabi.tar.xz`, `gcc-arm-10.3-2021.07-mingw-w64-i686-aarch64-none-elf.tar.xz` +- tftp工具,`tftp.zip` -- 创建SDK的profile文件,并添加读写权限 -``` -$ touch /etc/profile.d/phytium_standalone_sdk.sh -$ chmod 666 /etc/profile.d/phytium_standalone_sdk.sh -``` +- (2). 创建Windows集成开发环境(DEV目录),如`D:/phytium-dev`, 将DEV目录添加在Windows环境变量中,变量名为`PHYTIUM_DEV_PATH`,如下图所示,保存环境变量, -- 在`D:\phytium-dev\phytium-standalone-sdk`目录下双击`run_mingw64.cmd`, 启动`Msys2`控制台,在控制台输入`./install.py`完成SDK安装 +> 对于Windows 10,在桌面左下角系统搜索框中输入“环境变量”即可进入环境变量编辑界面 -- **安装完成后关闭shell重新打开,生效 Standalone SDK 环境**, 检查SDK路径是否与环境变量`STANDALONE_SDK_ROOT`一致 +> DEV目录中不要留空格 -#### 2.1.3 卸载开发环境 +![输入图片说明](https://images.gitee.com/uploads/images/2021/1013/192453_4e609b79_8736513.png "配置环境变量.png") -- 在SDK目录`D:\phytium-dev\phytium-standalone-sdk`目录双击`run_mingw64.cmd`, 启动`Msys2`控制台,在控制台输入`./uninstall.py`完成SDK卸载 +- (3). 保存DEV环境变量后,打开一个控制台,输入`echo %PHYTIUM_DEV_PATH%`,检查环境变量是否设置成功, -- 在`Msys2`控制台运行`sudo rm /etc/profile.d/phytium_standalone_sdk.sh`,删除SDK配置文件 +![输入图片说明](https://images.gitee.com/uploads/images/2021/1013/164646_3fbc5df8_8736513.png "检查环境变量.png") -- 在DEV目录`D:\phytium-dev\tftp`下以**管理员权限**打开Windows命令行中断,运行`uninstall.cmd`完成Tftd卸载 +- (4). 双击`msys2-x86_64-20210725.exe`,设置`Msys2`的安装路径在DEV路径下,其余设置按默认安装,注意安装完成后不要马上启动,最后一步取消勾选“马上启动Msys2” -### 2.2 Ubuntu 20.04 x86_64 环境下使用 Standalone SDK +![输入图片说明](https://images.gitee.com/uploads/images/2021/1013/164805_4169d4d2_8736513.png "安装Msys2.png") -#### 2.2.1 选择在线方式安装 SDK +![Msys2安装过程](https://images.gitee.com/uploads/images/2021/1013/135101_c8fc0454_8736513.png "Msys2安装过程.png") -- 通过 Gitee 拉取 Standalone SDK 源代码 +- (5). `Msys2`安装完成后,需要添加国内软件源,否则下载速度会很慢,进入`D:\phytium-dev\msys64\etc\pacman.d`目录下,找到以下三个文件,在文件末尾分别添加对应的软件源 +- mirrorlist.mingw32 ``` -$ git clone https://gitee.com/phytium_embedded/phytium-standalone-sdk.git ~/standalone_sdk -$ cd ~/standalone_sdk +Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/i686 ``` -- 检查 install.py 的执行权限, 如果没有执行权限`x`,需要利用`chmod +x ./install.py`添加执行权限 - +- mirrorlist.mingw64 ``` -$ ls ./install.py -l --rwxrwxrwx 1 usr usr 6353 Jul 21 10:13 ./install.py +Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/x86_64 ``` -- 在线下载源代码和编译环境,创建SDK的profile,并为用户添加读写权限,然后完成 Standalone SDK 安装 -> 注意不要使用'sudo ./install.py',否则环境变量配置可能不正确 - +- mirrorlist.msys ``` -$ sudo touch /etc/profile.d/phytium_standalone_sdk.sh -$ sudo chmod 666 /etc/profile.d/phytium_standalone_sdk.sh -$ ./install.py -online +Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/$arch ``` -![输入图片说明](https://images.gitee.com/uploads/images/2021/1014/112439_2a038045_8736513.png "安装过程.png") - - -- **安装完成后重启系统,生效 Standalone SDK 环境** - ->请注意使用虚拟机进行开发时不要将sdk安装在挂载的共享文件夹下,否则交叉编译链的部分链接文件可能无法工作 +- (6). 进入`D:\phytium-dev\msys64`目录,双击`msys2_shell.cmd`启动运行`Msys2`,输入以下命令,更新`Msys2`软件,安装必要组件 -#### 2.2.2 选择离线方式安装 SDK - -- 下载[Phytium Standalone SDK](https://gitee.com/phytium_embedded/phytium-standalone-sdk)源代码 -- 下载[AARCH32](https://gitee.com/phytium_embedded/phytium-standalone-sdk/attach_files/776847/download/gcc-arm-x86_64-none-eabi-10-2020-q4-major.tar.xz)编译器 -- 下载[AARCH64](https://gitee.com/phytium_embedded/phytium-standalone-sdk/attach_files/776846/download/gcc-arm-x86_64-aarch64-none-elf-10.2-2020.11.tar.xz)编译器 +> 如果执行失败,可以多次尝试,直到没有报错 -- 解压 phytium_standalone_sdk.zip 为`~/standalone_sdk`(路径名可以自定义) -- 将 AARCH32、AARCH64 编译器压缩包放置在`~/standalone_sdk/tools`(必须放置在 tools 路径下) -- 确保 install.py 有执行权限,`~/standalone_sdk`Standalone SDK 安装 +> 安装过程全部选用默认方式`default`或选择`y`,注意如果没有`default = all`,需要输入`y` ``` -$ sudo touch /etc/profile.d/phytium_standalone_sdk.sh -$ sudo chmod 666 /etc/profile.d/phytium_standalone_sdk.sh -$ ./install.py +$ pacman -Syu +$ pacman -S mingw-w64-x86_64-toolchain +$ pacman -S base-devel git python3 python3-pip ``` -- **安装完成后重启系统,生效 Standalone SDK 环境** - -#### 2.2.3 卸载开发环境 - -- 在SDK目录运行`./uninstall.py`完成SDK卸载 - -- 运行`sudo rm /etc/profile.d/phytium_standalone_sdk.sh`,删除SDK配置文件 - -### 2.3 Kylin OS/Ubuntu 20.04 AARCH64 环境下使用 Standalone SDK - -#### 2.3.1 选择在线方式安装 SDK - -参考 2.3.1 选择在线方式安装 SDK - -#### 2.3.2 选择离线方式安装 SDK - -- 下载[Phytium Standalone SDK](https://gitee.com/phytium_embedded/phytium-standalone-sdk)源代码 -- 下载[AARCH32](https://gitee.com/phytium_embedded/phytium-standalone-sdk/attach_files/779742/download/gcc-arm-aarch64-none-eabi-10-2020-q4-major.tar.xz)编译器 -- 下载[AARCH64](https://gitee.com/phytium_embedded/phytium-standalone-sdk/attach_files/779743/download/gcc-arm-10.2-2020.11-aarch64-aarch64-none-elf.tar.xz)编译器 - -- 解压 phytium_standalone_sdk.zip 为`~/standalone_sdk`(路径名可以自定义) -- 将 AARCH32、AARCH64 编译器压缩包放置在`~/standalone_sdk/tools`(必须放置在 tools 路径下) -- 确保 install.py 有执行权限,`~/standalone_sdk`Standalone SDK 安装 +![更新Msys2软件源](https://images.gitee.com/uploads/images/2021/1013/140545_6cda8ecc_8736513.png "更新Msys2软件源.png") +- (7). 运行以下命令,检查组件是否安装完全 ``` -$ sudo touch /etc/profile.d/phytium_standalone_sdk.sh -$ ./install.py +$ pacman -Q make git wget python3 python3-pip ``` -### 2.4 新建一个 baremetal 应用工程 - -#### 2.4.1 选择工程模板 +### 2.4 卸载开发环境 -##### 2.4.1.1 Window环境使用工程 +- 在DEV目录下双击`run_msys2.cmd`, 启动`Msys2`控制台,在控制台输入`./uninstall.py`完成SDK卸载 -- 复制`~/standalone-sdk/example/template-mingw64`目录,作为baremetal应用工程 +- 在`Msys2`控制台运行`rm /etc/profile.d/phytium_standalone_sdk.sh`,删除SDK配置文件 -> `*` 表示可选文件/目录 - -``` -Kconfig --> 应用工程配置menu文件 -makefile --> makefile -main.c --> 包含main函数 -sdkconfig --> 配置输出 -sdkconfig.h --> 配置输出 -run_mingw64.cmd --> 启动msys-mingw64控制台* -inc --> 用户头文件* -src --> 用户源文件* -``` +- 在DEV目录`D:\phytium-dev\tftp`下以**管理员权限**打开Windows命令行中断,运行`uninstall.cmd`完成Tftd卸载 -![输入图片说明](https://images.gitee.com/uploads/images/2021/1013/144914_9e06694b_8736513.png "屏幕截图.png") +--- +## 3. 使用方法 -- 双击run_mingw64.cmd,在当前目录启动mingw64控制台 +### 3.1 新建一个 baremetal 应用工程 -##### 2.4.1.2 Linux环境使用工程 +#### 3.1.1 选择工程模板 - 复制`~/standalone-sdk/example/template`目录,作为 baremetal 应用工程 @@ -283,7 +178,7 @@ src --> 用户源文件* >请注意使用小写makefile,使用Makefile在部分平台不能被识别 -#### 2.4.2 选择目标平台 +#### 3.1.2 选择目标平台 - 切换目标平台, e.g `FT2000/4 AARCH32`, 加载默认配置 @@ -308,15 +203,15 @@ template.map --> 内存布局文件 ![输入图片说明](https://images.gitee.com/uploads/images/2021/0709/141655_f20b6d98_8736513.png "屏幕截图.png") -### 2.5 快速使用例程 +### 3.2 快速使用例程 > ~/standalone-sdk/example/aarch32_hello_world ![输入图片说明](https://images.gitee.com/uploads/images/2021/0709/145025_398f6501_8736513.png "屏幕截图.png") -### 2.6 下载镜像跳转启动 +### 3.3 下载镜像跳转启动 -#### 2.6.1 在 host 侧(Ubuntu 20.04)配置 tftp 服务 +#### 3.3.1 在 host 侧(Ubuntu 20.04)配置 tftp 服务 - 在开发环境`host`侧安装`tftp`服务 @@ -381,7 +276,7 @@ tftp> get test1234 tftp> q ``` -#### 2.6.2 在 host 侧(Windows)配置 tftp 服务 +#### 3.3.2 在 host 侧(Windows)配置 tftp 服务 - 将2.1.1章下载的`tftp.zip`解压到开发环境,如`D:\phytium-dev\tftp` - 以**管理员权限**打开Windows cmd,进入`D:\phytium-dev\tftp`,运行`.\reinstall.cmd`完成Tftpd服务安装 @@ -402,7 +297,7 @@ tftp> q > 在`template_mingw64`工程中,通过定义`USR_BOOT_DIR`可以将编译的镜像自动拷贝带tftp目录下 -#### 2.6.3 配置开发板 ip,连通 host 下载启动镜像 +#### 3.3.3 配置开发板 ip,连通 host 下载启动镜像 - 将`BIN`文件或者`ELF`文件复制到`tftpboot`目录 @@ -442,61 +337,61 @@ $ cp ./baremetal.elf /mnt/d/tftboot --- -## 3. SDK 源代码结构 +## 4. SDK 源代码结构 ``` . -├── Kconfig --> 配置定义 -├── LICENSE --> 版权声明 -├── README.md -├── standalone.mk +├── Kconfig --> 配置定义 +├── LICENSE --> 版权声明 +├── README.md --> 使用说明 +├── arch +│   └── armv8 --> 架构相关 ├── baremetal -│ └── example --> 裸机例程 -| ├── can_test -| └── i2c_eeprom -| └── sdci_test ... -├── arch --> 架构相关 -| ├── armv8 -| | ├── aarch32 -| | └── aarch64 -| └── common -├── common -├── drivers --> 外设驱动 -| ├── can -| └── eth -| └── gic ... -├── board --> 目标平台相关 -| ├── d2000 -| └── ft2004 -| └── e2000 -├── configs --> 各目标平台的默认配置 -│ ├── d2000_aarch32_defconfig -│ └── d2000_aarch64_defconfig -| └── e2000_aarch32_defconfig -| └── e2000_aarch64_defconfig -| └── ft2004_aarch32_defconfig -| └── ft2004_aarch64_defconfig +│   └── example --> 裸机例程 +├── board +│   ├── d2000 +│   ├── e2000 +│   └── ft2004 --> 平台相关 +├── common +│   ├── f_printf.c +│   ├── f_printf.h +│   ├── fsleep.c +│   └── fsleep.h --> 通用方法 +├── configs +│   ├── ft2004_aarch32_defconfig +│   └── ft2004_aarch64_defconfig --> 各平台默认配置 ├── doc -│ ├── ChangeLog.md -│ └── checklist.md -├── install.py --> 环境变量安装脚本 -├── lib --> 依赖库 -│ ├── Kconfiglib -│ ├── libc -│ └── nostdlib -├── make --> Makefile文件 -├── scripts --> 相关脚本 -├── third-party --> 第三方库 -└── tools --> 编译构建相关工具 - ├── README.md - ├── gcc-arm-10.2-2020.11-x86_64-aarch64-none-elf +│   ├── ChangeLog.md +│   └── system.dio --> 文档和修改记录 +├── drivers +│   ├── can +│   ├── dma +│   └── watchdog --> 外设驱动 +├── install.py --> 安装脚本 +├── lib +│   ├── Kconfiglib +│   ├── lib.mk +│   ├── libc +│   └── nostdlib --> 依赖库 +├── make +│   ├── build_baremetal.mk +│   ├── buildinfo.mk +│   ├── complier.mk +│   └── preconfig.mk --> 编译脚本和链接脚本 +├── requirements.txt --> python环境依赖组件 +├── scripts +├── standalone.mk +├── third-party +│   ├── letter-shell-3.1 +│   └── yaffs2 --> 第三方库 +├── tools +└── uninstall.py --> 卸载脚本 ``` - --- -## 4. 硬件平台 +## 5. 硬件平台 -### 4.1 FT2000-4 +### 5.1 FT2000-4 FT-2000/4 是一款面向桌面应用的高性能通用 4 核处理器。每 2 个核构成 1 个处理器核簇(Cluster),并共享 L2 Cache。主要技术特征如下: @@ -512,7 +407,7 @@ FT-2000/4 是一款面向桌面应用的高性能通用 4 核处理器。每 2 - 集成 4 个 UART,1 个 LPC,32 个 GPIO,4 个 I2C,1 个 QSPI,2 个通 用 SPI,2 个 WDT,16 个外部中断(和 GPIO 共用 IO) - 集成温度传感器 -### 4.2 D2000 +### 5.2 D2000 D2000 是一款面向桌面应用的高性能通用 8 核处理器。每 2 个核构成 1 个处理器核簇(Cluster),并共享 L2 Cache。存储系统包含 Cache 子系统和 DDR,I/O 系统包含 PCIe、高速 IO 子系统、千兆位以太网 GMAC 和低速 IO 子系统,主要技术特征如下, @@ -530,9 +425,9 @@ D2000 是一款面向桌面应用的高性能通用 8 核处理器。每 2 个 --- -## 5. 支持情况 +## 6. 支持情况 -### 5.1 外设驱动支持情况 +### 6.1 外设驱动支持情况 | Hardware Interface | Platform Supported | Platform Developing | Component | | ------------------------------ | -------------------------- | ------------------- | -------------------- | @@ -562,7 +457,7 @@ D2000 是一款面向桌面应用的高性能通用 8 核处理器。每 2 个 | Yaffs2 | | E2000 | | --- -## 6. 参考资源 +## 7. 参考资源 - ARM Architecture Reference Manual - ARM Cortex-A Series Programmer’s Guide @@ -578,7 +473,7 @@ D2000 是一款面向桌面应用的高性能通用 8 核处理器。每 2 个 --- -## 7. 贡献方法 +## 8. 贡献方法 请联系飞腾嵌入式软件部 @@ -590,6 +485,6 @@ wangxiaodong1030@phytium.com.cn --- -## 8. 许可协议 +## 9. 许可协议 Apache-2.0 diff --git a/baremetal/example/can_test/sdkconfig b/baremetal/example/can_test/sdkconfig index dfda2419e..559e61777 100644 --- a/baremetal/example/can_test/sdkconfig +++ b/baremetal/example/can_test/sdkconfig @@ -74,7 +74,7 @@ CONFIG_ENABLE_F_CAN=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX=y # # Cross-Compiler Setting @@ -111,7 +111,7 @@ CONFIG_STACK_SIZE=0x1000 # # Library Configuration # -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y # end of Library Configuration # diff --git a/baremetal/example/can_test/sdkconfig.h b/baremetal/example/can_test/sdkconfig.h index 372552ce7..317cc33e6 100644 --- a/baremetal/example/can_test/sdkconfig.h +++ b/baremetal/example/can_test/sdkconfig.h @@ -63,7 +63,7 @@ /* Building Option */ -#define CONFIG_ENVI_UBUNTU_20_04 +#define CONFIG_ENVI_LINUX /* Cross-Compiler Setting */ @@ -96,7 +96,7 @@ /* Library Configuration */ -#define CONFIG_USE_LIBC +#define CONFIG_USE_G_LIBC /* end of Library Configuration */ /* Third-Party Configuration */ diff --git a/baremetal/example/gdma_test/sdkconfig b/baremetal/example/gdma_test/sdkconfig index cf3b71ce0..7db58a123 100644 --- a/baremetal/example/gdma_test/sdkconfig +++ b/baremetal/example/gdma_test/sdkconfig @@ -70,7 +70,7 @@ CONFIG_ENABLE_F_GDMA=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX=y # # Cross-Compiler Setting @@ -107,7 +107,7 @@ CONFIG_STACK_TOP_ADDR=0x82000000 # # Library Configuration # -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y # end of Library Configuration # diff --git a/baremetal/example/gdma_test/sdkconfig.h b/baremetal/example/gdma_test/sdkconfig.h index b511f9682..e2fa569d5 100644 --- a/baremetal/example/gdma_test/sdkconfig.h +++ b/baremetal/example/gdma_test/sdkconfig.h @@ -61,7 +61,7 @@ /* Building Option */ -#define CONFIG_ENVI_UBUNTU_20_04 +#define CONFIG_ENVI_LINUX /* Cross-Compiler Setting */ @@ -94,7 +94,7 @@ /* Library Configuration */ -#define CONFIG_USE_LIBC +#define CONFIG_USE_G_LIBC /* end of Library Configuration */ /* Third-Party Configuration */ diff --git a/baremetal/example/letter_shell_test/sdkconfig b/baremetal/example/letter_shell_test/sdkconfig index 1a7413bc4..583af6fbc 100644 --- a/baremetal/example/letter_shell_test/sdkconfig +++ b/baremetal/example/letter_shell_test/sdkconfig @@ -62,7 +62,7 @@ CONFIG_ENABLE_Pl011_UART=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX=y # # Cross-Compiler Setting diff --git a/baremetal/example/libmetal_test/configs/d2000_amp_core0_aarch32_defconfig b/baremetal/example/libmetal_test/configs/d2000_amp_core0_aarch32_defconfig index c0690fe86..861b8200f 100644 --- a/baremetal/example/libmetal_test/configs/d2000_amp_core0_aarch32_defconfig +++ b/baremetal/example/libmetal_test/configs/d2000_amp_core0_aarch32_defconfig @@ -77,7 +77,7 @@ CONFIG_ENABLE_Pl011_UART=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX_X86_64=y # # Cross-Compiler Setting diff --git a/baremetal/example/libmetal_test/configs/d2000_amp_core0_aarch64_defconfig b/baremetal/example/libmetal_test/configs/d2000_amp_core0_aarch64_defconfig index ab059023e..c096c88a9 100644 --- a/baremetal/example/libmetal_test/configs/d2000_amp_core0_aarch64_defconfig +++ b/baremetal/example/libmetal_test/configs/d2000_amp_core0_aarch64_defconfig @@ -76,7 +76,7 @@ CONFIG_ENABLE_Pl011_UART=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX_X86_64=y # # Cross-Compiler Setting diff --git a/baremetal/example/libmetal_test/configs/d2000_amp_core1_aarch32_defconfig b/baremetal/example/libmetal_test/configs/d2000_amp_core1_aarch32_defconfig index 0bdc9f9c5..c4c078283 100644 --- a/baremetal/example/libmetal_test/configs/d2000_amp_core1_aarch32_defconfig +++ b/baremetal/example/libmetal_test/configs/d2000_amp_core1_aarch32_defconfig @@ -69,7 +69,7 @@ CONFIG_EBABLE_GICV3=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX_X86_64=y # # Cross-Compiler Setting diff --git a/baremetal/example/libmetal_test/configs/d2000_amp_core1_aarch64_defconfig b/baremetal/example/libmetal_test/configs/d2000_amp_core1_aarch64_defconfig index 1d0dc5662..537ea8259 100644 --- a/baremetal/example/libmetal_test/configs/d2000_amp_core1_aarch64_defconfig +++ b/baremetal/example/libmetal_test/configs/d2000_amp_core1_aarch64_defconfig @@ -68,7 +68,7 @@ CONFIG_EBABLE_GICV3=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX_X86_64=y # # Cross-Compiler Setting diff --git a/baremetal/example/libmetal_test/core0/sdkconfig b/baremetal/example/libmetal_test/core0/sdkconfig index ab059023e..c096c88a9 100644 --- a/baremetal/example/libmetal_test/core0/sdkconfig +++ b/baremetal/example/libmetal_test/core0/sdkconfig @@ -76,7 +76,7 @@ CONFIG_ENABLE_Pl011_UART=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX_X86_64=y # # Cross-Compiler Setting diff --git a/baremetal/example/libmetal_test/core0/sdkconfig.h b/baremetal/example/libmetal_test/core0/sdkconfig.h index 7c0b37a9a..b253c6938 100644 --- a/baremetal/example/libmetal_test/core0/sdkconfig.h +++ b/baremetal/example/libmetal_test/core0/sdkconfig.h @@ -66,7 +66,7 @@ /* Building Option */ -#define CONFIG_ENVI_UBUNTU_20_04 +#define CONFIG_ENVI_LINUX_X86_64 /* Cross-Compiler Setting */ diff --git a/baremetal/example/libmetal_test/core1/sdkconfig b/baremetal/example/libmetal_test/core1/sdkconfig index 1d0dc5662..537ea8259 100644 --- a/baremetal/example/libmetal_test/core1/sdkconfig +++ b/baremetal/example/libmetal_test/core1/sdkconfig @@ -68,7 +68,7 @@ CONFIG_EBABLE_GICV3=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX_X86_64=y # # Cross-Compiler Setting diff --git a/baremetal/example/libmetal_test/core1/sdkconfig.h b/baremetal/example/libmetal_test/core1/sdkconfig.h index c5ad15e9e..ada3fc51e 100644 --- a/baremetal/example/libmetal_test/core1/sdkconfig.h +++ b/baremetal/example/libmetal_test/core1/sdkconfig.h @@ -60,7 +60,7 @@ /* Building Option */ -#define CONFIG_ENVI_UBUNTU_20_04 +#define CONFIG_ENVI_LINUX_X86_64 /* Cross-Compiler Setting */ diff --git a/baremetal/example/lwip_test/sdkconfig b/baremetal/example/lwip_test/sdkconfig index fd1e7222d..e9f1c3e20 100644 --- a/baremetal/example/lwip_test/sdkconfig +++ b/baremetal/example/lwip_test/sdkconfig @@ -79,7 +79,7 @@ CONFIG_F_GMAC_PHY_AR803X=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX_X86_64=y # # Cross-Compiler Setting @@ -116,7 +116,7 @@ CONFIG_STACK_SIZE=0x1000 # # Library Configuration # -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y # end of Library Configuration # diff --git a/baremetal/example/lwip_test/sdkconfig.h b/baremetal/example/lwip_test/sdkconfig.h index 80d82b8a7..f2cee10b0 100644 --- a/baremetal/example/lwip_test/sdkconfig.h +++ b/baremetal/example/lwip_test/sdkconfig.h @@ -69,7 +69,7 @@ /* Building Option */ -#define CONFIG_ENVI_UBUNTU_20_04 +#define CONFIG_ENVI_LINUX_X86_64 /* Cross-Compiler Setting */ @@ -102,7 +102,7 @@ /* Library Configuration */ -#define CONFIG_USE_LIBC +#define CONFIG_USE_G_LIBC /* end of Library Configuration */ /* Third-Party Configuration */ diff --git a/baremetal/example/nand_flash_test/sdkconfig b/baremetal/example/nand_flash_test/sdkconfig index e97a89350..98503aff2 100644 --- a/baremetal/example/nand_flash_test/sdkconfig +++ b/baremetal/example/nand_flash_test/sdkconfig @@ -59,7 +59,7 @@ CONFIG_EBABLE_GICV3=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX=y # # Cross-Compiler Setting @@ -96,7 +96,7 @@ CONFIG_STACK_SIZE=0x1000 # # Library Configuration # -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y # end of Library Configuration # diff --git a/baremetal/example/nand_flash_test/sdkconfig.h b/baremetal/example/nand_flash_test/sdkconfig.h index b1c01ae47..8ce5c6f21 100644 --- a/baremetal/example/nand_flash_test/sdkconfig.h +++ b/baremetal/example/nand_flash_test/sdkconfig.h @@ -52,7 +52,7 @@ /* Building Option */ -#define CONFIG_ENVI_UBUNTU_20_04 +#define CONFIG_ENVI_LINUX_X86_64 /* Cross-Compiler Setting */ diff --git a/baremetal/example/newlibc_test/Kconfig b/baremetal/example/newlibc_test/Kconfig new file mode 100644 index 000000000..16847f50f --- /dev/null +++ b/baremetal/example/newlibc_test/Kconfig @@ -0,0 +1,11 @@ +mainmenu "Phytium Baremetal Configuration" + +menu "Project Configuration" + config TARGET_NAME + string "Build Target Name" + default "baremetal" + help + Build Target name for the demo +endmenu + +source "$(STANDALONE_SDK_ROOT)/Kconfig" diff --git a/baremetal/example/newlibc_test/README.md b/baremetal/example/newlibc_test/README.md new file mode 100644 index 000000000..1ba579af9 --- /dev/null +++ b/baremetal/example/newlibc_test/README.md @@ -0,0 +1,81 @@ + +# Newlib + +## 1. 例程介绍 + +>介绍例程的用途,使用场景,相关基本概念,描述用户可以使用例程完成哪些工作
+ +Newlib是一个面向嵌入式系统的C运行库。最初是由Cygnus Solutions收集组装的一个源代码集合,取名为newlib,现在由Red Hat维护,本SDK中使用的是4.1.0版本,newlib可移植性强,具有可重入特性、功能完备等特点,已广泛应用于各种嵌入式系统中,相比于Glibc,newlib对嵌入式应用的支持更好 + +## 2. 如何使用例程 + +>描述开发平台准备,使用例程配置,构建和下载镜像的过程
+ +在Library Configuration中选择Use New Lib + +### 2.1 硬件配置方法 + +>哪些硬件平台是支持的,需要哪些外设,例程与开发板哪些IO口相关等(建议附录开发板照片,展示哪些IO口被引出)
+ +- FT2000/4 +- D2000 + +### 2.2 SDK配置方法 + +>依赖哪些驱动、库和第三方组件,如何完成配置(列出需要使能的关键配置项)
+ +- 依赖本SDK提供的交叉编译链 + +### 2.3 构建和下载 + +>描述构建、烧录下载镜像的过程,列出相关的命令
+ +- host侧设置重启host侧tftp服务器 +``` +sudo service tftpd-hpa restart +``` + +- 开发板侧使用bootelf命令跳转 +``` +setenv ipaddr 192.168.4.20 +setenv serverip 192.168.4.50 +setenv gatewayip 192.168.4.1 +tftpboot 0x90100000 baremetal.elf +bootelf -p 0x90100000 +``` + +### 2.4 输出与实验现象 + +>描述输入输出情况,列出存在哪些输出,对应的输出是什么(建议附录相关现象图片)
+ +- 通过u-boot启动,完成浮点打印 +``` +# bootelf -p 0x90100000 +## Starting application at 0x80100000 ... +hello baremetal phytium 3.141500 + +``` + +## 3. 如何解决问题 + +>主要记录使用例程中可能会遇到的问题,给出相应的解决方案
+ +## 4. 修改历史记录 + +>记录例程的重大修改记录,标明修改发生的版本号
+ +- v0.1.6,2021/10/19 首次合入 + + diff --git a/baremetal/example/newlibc_test/main.c b/baremetal/example/newlibc_test/main.c new file mode 100644 index 000000000..acd6770e8 --- /dev/null +++ b/baremetal/example/newlibc_test/main.c @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2021 Phytium Information Technology, Inc. + * + * SPDX-License-Identifier: Apache-2.0. + * + * @Date: 2021-07-09 08:08:39 + * @LastEditTime: 2021-10-15 18:29:13 + * @Description:  This files is for phytium baremetal hello world + * + * @Modify History: + * Ver   Who        Date         Changes + * ----- ------     --------    -------------------------------------- + */ +#include + +int main() +{ + printf("hello baremetal phytium %f\r\n", 3.1415); + return 0; +} diff --git a/baremetal/example/newlibc_test/makefile b/baremetal/example/newlibc_test/makefile new file mode 100644 index 000000000..3e4c839e5 --- /dev/null +++ b/baremetal/example/newlibc_test/makefile @@ -0,0 +1,26 @@ +# 指定工程项目根目录为当前(只能指定一个目录) +export PROJECT_DIR ?= . +# 用户添加的源文件夹和头文件夹(可以指定多个) +export USR_SRC_DIR ?= . \ + ./src +export USR_INC_DIR ?= . \ + ./inc + +# 用户定义的编译目标文件上传路径 +ifeq ($(OS),Windows_NT) + USR_BOOT_DIR ?= $(subst \,/, $(PHYTIUM_DEV_PATH))/tftp +else + USR_BOOT_DIR ?= /mnt/d/phytium-dev/tftp +endif + +# 设置启动镜像名 +BOOT_IMG_NAME ?= baremetal + +# 指定编译freertos项目使用的makefile +include $(STANDALONE_SDK_ROOT)/make/build_baremetal.mk + +# 完成编译 +boot: + make + @cp ./$(CONFIG_TARGET_NAME).elf $(USR_BOOT_DIR)/$(BOOT_IMG_NAME).elf + @ls $(USR_BOOT_DIR)/$(BOOT_IMG_NAME).elf -l diff --git a/baremetal/example/newlibc_test/sdkconfig b/baremetal/example/newlibc_test/sdkconfig new file mode 100644 index 000000000..4681129e4 --- /dev/null +++ b/baremetal/example/newlibc_test/sdkconfig @@ -0,0 +1,106 @@ + +# +# Project Configuration +# +CONFIG_TARGET_NAME="d2000_baremetal_a32" +# end of Project Configuration + +# +# Platform Setting +# + +# +# 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_EBABLE_GICV3=y +# CONFIG_USE_SERIAL is not set +# CONFIG_USE_GPIO is not set +# CONFIG_USE_IOMUX is not set +# CONFIG_USE_ETH is not set +# 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 +# end of Components Configuration +# end of Platform Setting + +# +# Building Option +# + +# +# Cross-Compiler Setting +# +CONFIG_COMPILER_NO_STD_STARUP=y +# 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_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 +CONFIG_ROM_SIZE_MB=1 +CONFIG_LINK_SCRIPT_RAM=y +CONFIG_RAM_START_UP_ADDR=0x81000000 +CONFIG_RAM_SIZE_MB=64 +CONFIG_HEAP_SIZE=0x04000 +CONFIG_STACK_SIZE=0x1000 +# end of Linker Options +# end of Building Option + +# +# Library Configuration +# +CONFIG_USE_G_LIBC=y +# CONFIG_USE_NEW_LIBC is not set +# end of Library Configuration + +# +# Third-Party Configuration +# +# CONFIG_USE_LWIP is not set +# CONFIG_USE_LETTER_SHELL is not set +# CONFIG_USE_AMP is not set +# CONFIG_USE_YAFFS2 is not set +# CONFIG_USE_SDMMC_CMD is not set +# end of Third-Party Configuration diff --git a/baremetal/example/newlibc_test/sdkconfig.h b/baremetal/example/newlibc_test/sdkconfig.h new file mode 100644 index 000000000..df40c87c9 --- /dev/null +++ b/baremetal/example/newlibc_test/sdkconfig.h @@ -0,0 +1,97 @@ +#ifndef SDK_CONFIG_H__ +#define SDK_CONFIG_H__ + +/* Project Configuration */ + +#define CONFIG_TARGET_NAME "d2000_baremetal_a32" +/* end of Project Configuration */ + +/* Platform Setting */ + +/* Arch Configuration */ + +#define CONFIG_TARGET_ARMV8_AARCH32 +/* CONFIG_TARGET_ARMV8_AARCH64 is not set */ +/* CONFIG_TARGET_ARMV7 is not set */ +#define CONFIG_USE_CACHE +#define CONFIG_USE_L3CACHE +#define CONFIG_USE_MMU +/* CONFIG_USE_SYS_TICK is not set */ +#define CONFIG_USE_AARCH64_L1_TO_AARCH32 +/* end of Arch Configuration */ + +/* Board Configuration */ + +/* CONFIG_TARGET_F2000_4 is not set */ +/* CONFIG_TARGET_E2000 is not set */ +#define CONFIG_TARGET_D2000 +/* end of Board Configuration */ + +/* Components Configuration */ + +/* CONFIG_USE_SPI is not set */ +/* CONFIG_USE_QSPI is not set */ +#define CONFIG_USE_GIC +#define CONFIG_EBABLE_GICV3 +/* CONFIG_USE_SERIAL is not set */ +/* CONFIG_USE_GPIO is not set */ +/* CONFIG_USE_IOMUX is not set */ +/* CONFIG_USE_ETH is not set */ +/* 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 */ +/* end of Components Configuration */ +/* end of Platform Setting */ + +/* Building Option */ + +/* Cross-Compiler Setting */ + +#define CONFIG_COMPILER_NO_STD_STARUP +/* CONFIG_USE_EXT_COMPILER is not set */ +/* 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_ERROR is not set */ +/* CONFIG_LOG_NONE is not set */ + +/* 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 +#define CONFIG_ROM_SIZE_MB 1 +#define CONFIG_LINK_SCRIPT_RAM +#define CONFIG_RAM_START_UP_ADDR 0x81000000 +#define CONFIG_RAM_SIZE_MB 64 +#define CONFIG_HEAP_SIZE 0x04000 +#define CONFIG_STACK_SIZE 0x1000 +/* end of Linker Options */ +/* end of Building Option */ + +/* Library Configuration */ + +#define CONFIG_USE_G_LIBC +/* CONFIG_USE_NEW_LIBC is not set */ +/* end of Library Configuration */ + +/* Third-Party Configuration */ + +/* CONFIG_USE_LWIP is not set */ +/* CONFIG_USE_LETTER_SHELL is not set */ +/* CONFIG_USE_AMP is not set */ +/* CONFIG_USE_YAFFS2 is not set */ +/* CONFIG_USE_SDMMC_CMD is not set */ +/* end of Third-Party Configuration */ + +#endif diff --git a/baremetal/example/overall_test/sdkconfig b/baremetal/example/overall_test/sdkconfig index 241352bc5..0ffab711c 100644 --- a/baremetal/example/overall_test/sdkconfig +++ b/baremetal/example/overall_test/sdkconfig @@ -72,7 +72,7 @@ CONFIG_USE_F_SDMMC=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX_X86_64=y # # Cross-Compiler Setting @@ -109,7 +109,7 @@ CONFIG_STACK_SIZE=0x1000 # # Library Configuration # -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y # end of Library Configuration # diff --git a/baremetal/example/overall_test/sdkconfig.h b/baremetal/example/overall_test/sdkconfig.h index 215c44f2e..02efdd143 100644 --- a/baremetal/example/overall_test/sdkconfig.h +++ b/baremetal/example/overall_test/sdkconfig.h @@ -64,7 +64,7 @@ /* Building Option */ -#define CONFIG_ENVI_UBUNTU_20_04 +#define CONFIG_ENVI_LINUX_X86_64 /* Cross-Compiler Setting */ @@ -97,7 +97,7 @@ /* Library Configuration */ -#define CONFIG_USE_LIBC +#define CONFIG_USE_G_LIBC /* end of Library Configuration */ /* Third-Party Configuration */ diff --git a/baremetal/example/pcie_test/sdkconfig b/baremetal/example/pcie_test/sdkconfig index 61412c911..acfc0d6ca 100644 --- a/baremetal/example/pcie_test/sdkconfig +++ b/baremetal/example/pcie_test/sdkconfig @@ -103,7 +103,7 @@ CONFIG_ENABLE_F_PCIE=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX_X86_64=y # # Cross-Compiler Setting @@ -140,7 +140,7 @@ CONFIG_STACK_TOP_ADDR=0x82000000 # # Library Configuration # -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y # end of Library Configuration # diff --git a/baremetal/example/pcie_test/sdkconfig.h b/baremetal/example/pcie_test/sdkconfig.h index 560637d02..0ffede323 100644 --- a/baremetal/example/pcie_test/sdkconfig.h +++ b/baremetal/example/pcie_test/sdkconfig.h @@ -85,7 +85,7 @@ /* Building Option */ -#define CONFIG_ENVI_UBUNTU_20_04 +#define CONFIG_ENVI_LINUX_X86_64 /* Cross-Compiler Setting */ @@ -118,7 +118,7 @@ /* Library Configuration */ -#define CONFIG_USE_LIBC +#define CONFIG_USE_G_LIBC /* end of Library Configuration */ /* Third-Party Configuration */ diff --git a/baremetal/example/qspi_nor_flash/sdkconfig b/baremetal/example/qspi_nor_flash/sdkconfig index c5e5bfe05..7a9bbc788 100644 --- a/baremetal/example/qspi_nor_flash/sdkconfig +++ b/baremetal/example/qspi_nor_flash/sdkconfig @@ -57,7 +57,7 @@ CONFIG_EBABLE_GICV3=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX_X86_64=y # # Cross-Compiler Setting @@ -94,7 +94,7 @@ CONFIG_STACK_TOP_ADDR=0x82000000 # # Library Configuration # -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y # end of Library Configuration # diff --git a/baremetal/example/qspi_nor_flash/sdkconfig.h b/baremetal/example/qspi_nor_flash/sdkconfig.h index f6a6191ac..fe7272502 100644 --- a/baremetal/example/qspi_nor_flash/sdkconfig.h +++ b/baremetal/example/qspi_nor_flash/sdkconfig.h @@ -52,7 +52,7 @@ /* Building Option */ -#define CONFIG_ENVI_UBUNTU_20_04 +#define CONFIG_ENVI_LINUX_X86_64 /* Cross-Compiler Setting */ @@ -85,7 +85,7 @@ /* Library Configuration */ -#define CONFIG_USE_LIBC +#define CONFIG_USE_G_LIBC /* end of Library Configuration */ /* Third-Party Configuration */ diff --git a/baremetal/example/spi_test/sdkconfig b/baremetal/example/spi_test/sdkconfig index 86f876a66..69f6b424f 100644 --- a/baremetal/example/spi_test/sdkconfig +++ b/baremetal/example/spi_test/sdkconfig @@ -94,7 +94,7 @@ CONFIG_ENABLE_FIOMUX=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX_X86_64=y # # Cross-Compiler Setting @@ -131,7 +131,7 @@ CONFIG_STACK_TOP_ADDR=0x82000000 # # Library Configuration # -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y # end of Library Configuration # diff --git a/baremetal/example/spi_test/sdkconfig.h b/baremetal/example/spi_test/sdkconfig.h index ac8dee893..798747db7 100644 --- a/baremetal/example/spi_test/sdkconfig.h +++ b/baremetal/example/spi_test/sdkconfig.h @@ -78,7 +78,7 @@ /* Building Option */ -#define CONFIG_ENVI_UBUNTU_20_04 +#define CONFIG_ENVI_LINUX_X86_64 /* Cross-Compiler Setting */ @@ -111,7 +111,7 @@ /* Library Configuration */ -#define CONFIG_USE_LIBC +#define CONFIG_USE_G_LIBC /* end of Library Configuration */ /* Third-Party Configuration */ diff --git a/baremetal/example/template-mingw64/makefile b/baremetal/example/template-mingw64/makefile index a9e515db0..8a5c502ed 100644 --- a/baremetal/example/template-mingw64/makefile +++ b/baremetal/example/template-mingw64/makefile @@ -7,7 +7,11 @@ export USR_INC_DIR ?= . \ ./inc # 用户定义的编译目标文件上传路径 (建议放置在tftp工具目录下) -USR_BOOT_DIR ?= $(subst \,/, $(PHYTIUM_DEV_PATH))/tftp +ifeq ($(OS),Windows_NT) + USR_BOOT_DIR ?= $(subst \,/, $(PHYTIUM_DEV_PATH))/tftp +else + USR_BOOT_DIR ?= /mnt/d/phytium-dev/tftp +endif # 设置启动镜像名 BOOT_IMG_NAME ?= baremetal diff --git a/baremetal/example/template-mingw64/sdkconfig b/baremetal/example/template-mingw64/sdkconfig index 7e3866fc4..7871d17b4 100644 --- a/baremetal/example/template-mingw64/sdkconfig +++ b/baremetal/example/template-mingw64/sdkconfig @@ -54,7 +54,7 @@ CONFIG_EBABLE_GICV3=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX_X86_64=y # # Cross-Compiler Setting @@ -91,7 +91,7 @@ CONFIG_STACK_SIZE=0x1000 # # Library Configuration # -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y # end of Library Configuration # diff --git a/baremetal/example/template-mingw64/sdkconfig.h b/baremetal/example/template-mingw64/sdkconfig.h index 8c3bf5b65..27238bdb9 100644 --- a/baremetal/example/template-mingw64/sdkconfig.h +++ b/baremetal/example/template-mingw64/sdkconfig.h @@ -49,7 +49,7 @@ /* Building Option */ -#define CONFIG_ENVI_UBUNTU_20_04 +#define CONFIG_ENVI_LINUX_X86_64 /* Cross-Compiler Setting */ @@ -82,7 +82,7 @@ /* Library Configuration */ -#define CONFIG_USE_LIBC +#define CONFIG_USE_G_LIBC /* end of Library Configuration */ /* Third-Party Configuration */ diff --git a/baremetal/example/template/makefile b/baremetal/example/template/makefile index 36d7ec5bc..3e4c839e5 100644 --- a/baremetal/example/template/makefile +++ b/baremetal/example/template/makefile @@ -7,7 +7,11 @@ export USR_INC_DIR ?= . \ ./inc # 用户定义的编译目标文件上传路径 -USR_BOOT_DIR ?= /mnt/d/tftboot/ +ifeq ($(OS),Windows_NT) + USR_BOOT_DIR ?= $(subst \,/, $(PHYTIUM_DEV_PATH))/tftp +else + USR_BOOT_DIR ?= /mnt/d/phytium-dev/tftp +endif # 设置启动镜像名 BOOT_IMG_NAME ?= baremetal @@ -19,3 +23,4 @@ include $(STANDALONE_SDK_ROOT)/make/build_baremetal.mk boot: make @cp ./$(CONFIG_TARGET_NAME).elf $(USR_BOOT_DIR)/$(BOOT_IMG_NAME).elf + @ls $(USR_BOOT_DIR)/$(BOOT_IMG_NAME).elf -l diff --git a/baremetal/example/template/sdkconfig b/baremetal/example/template/sdkconfig index 263fc5188..bc42fb652 100644 --- a/baremetal/example/template/sdkconfig +++ b/baremetal/example/template/sdkconfig @@ -53,7 +53,7 @@ CONFIG_EBABLE_GICV3=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX_X86_64=y # # Cross-Compiler Setting @@ -90,7 +90,7 @@ CONFIG_STACK_SIZE=0x1000 # # Library Configuration # -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y # end of Library Configuration # diff --git a/baremetal/example/template/sdkconfig.h b/baremetal/example/template/sdkconfig.h index d3c891f80..0768410b7 100644 --- a/baremetal/example/template/sdkconfig.h +++ b/baremetal/example/template/sdkconfig.h @@ -48,7 +48,7 @@ /* Building Option */ -#define CONFIG_ENVI_UBUNTU_20_04 +#define CONFIG_ENVI_LINUX_X86_64 /* Cross-Compiler Setting */ @@ -81,7 +81,7 @@ /* Library Configuration */ -#define CONFIG_USE_LIBC +#define CONFIG_USE_G_LIBC /* end of Library Configuration */ /* Third-Party Configuration */ diff --git a/baremetal/example/timer_tacho/sdkconfig b/baremetal/example/timer_tacho/sdkconfig index 2763f60bd..0a47aee94 100644 --- a/baremetal/example/timer_tacho/sdkconfig +++ b/baremetal/example/timer_tacho/sdkconfig @@ -60,7 +60,7 @@ CONFIG_ENABLE_TIMER_TACHO=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX_X86_64=y # # Cross-Compiler Setting @@ -97,7 +97,7 @@ CONFIG_STACK_SIZE=0x1000 # # Library Configuration # -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y # end of Library Configuration # diff --git a/baremetal/example/timer_tacho/sdkconfig.h b/baremetal/example/timer_tacho/sdkconfig.h index 2a908300c..9347dfb88 100644 --- a/baremetal/example/timer_tacho/sdkconfig.h +++ b/baremetal/example/timer_tacho/sdkconfig.h @@ -53,7 +53,7 @@ /* Building Option */ -#define CONFIG_ENVI_UBUNTU_20_04 +#define CONFIG_ENVI_LINUX_X86_64 /* Cross-Compiler Setting */ @@ -86,7 +86,7 @@ /* Library Configuration */ -#define CONFIG_USE_LIBC +#define CONFIG_USE_G_LIBC /* end of Library Configuration */ /* Third-Party Configuration */ diff --git a/baremetal/example/uart_test/sdkconfig b/baremetal/example/uart_test/sdkconfig index f6a2e84e3..01afc02cb 100644 --- a/baremetal/example/uart_test/sdkconfig +++ b/baremetal/example/uart_test/sdkconfig @@ -62,7 +62,7 @@ CONFIG_ENABLE_Pl011_UART=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX_X86_64=y # # Cross-Compiler Setting @@ -99,7 +99,7 @@ CONFIG_STACK_SIZE=0x1000 # # Library Configuration # -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y # end of Library Configuration # diff --git a/baremetal/example/uart_test/sdkconfig.h b/baremetal/example/uart_test/sdkconfig.h index 24a7f5bcc..65108dcd5 100644 --- a/baremetal/example/uart_test/sdkconfig.h +++ b/baremetal/example/uart_test/sdkconfig.h @@ -55,7 +55,7 @@ /* Building Option */ -#define CONFIG_ENVI_UBUNTU_20_04 +#define CONFIG_ENVI_LINUX_X86_64 /* Cross-Compiler Setting */ @@ -88,7 +88,7 @@ /* Library Configuration */ -#define CONFIG_USE_LIBC +#define CONFIG_USE_G_LIBC /* end of Library Configuration */ /* Third-Party Configuration */ diff --git a/baremetal/example/wdt_test/sdkconfig b/baremetal/example/wdt_test/sdkconfig index e8f12ee2f..493ab6b94 100644 --- a/baremetal/example/wdt_test/sdkconfig +++ b/baremetal/example/wdt_test/sdkconfig @@ -69,7 +69,7 @@ CONFIG_ENABLE_FWDT=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX_X86_64=y # # Cross-Compiler Setting @@ -106,7 +106,7 @@ CONFIG_STACK_SIZE=0x1000 # # Library Configuration # -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y # end of Library Configuration # diff --git a/baremetal/example/wdt_test/sdkconfig.h b/baremetal/example/wdt_test/sdkconfig.h index 3b9f2ee92..10c44311d 100644 --- a/baremetal/example/wdt_test/sdkconfig.h +++ b/baremetal/example/wdt_test/sdkconfig.h @@ -60,7 +60,7 @@ /* Building Option */ -#define CONFIG_ENVI_UBUNTU_20_04 +#define CONFIG_ENVI_LINUX_X86_64 /* Cross-Compiler Setting */ @@ -93,7 +93,7 @@ /* Library Configuration */ -#define CONFIG_USE_LIBC +#define CONFIG_USE_G_LIBC /* end of Library Configuration */ /* Third-Party Configuration */ diff --git a/baremetal/example/xmac_test/sdkconfig b/baremetal/example/xmac_test/sdkconfig index 14cfaada5..d81c468df 100644 --- a/baremetal/example/xmac_test/sdkconfig +++ b/baremetal/example/xmac_test/sdkconfig @@ -93,7 +93,7 @@ CONFIG_ENABLE_F_XMAC=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX_X86_64=y # # Cross-Compiler Setting @@ -130,7 +130,7 @@ CONFIG_STACK_TOP_ADDR=0x82000000 # # Library Configuration # -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y # end of Library Configuration # diff --git a/baremetal/example/xmac_test/sdkconfig.h b/baremetal/example/xmac_test/sdkconfig.h index ac3b37ef2..b72248362 100644 --- a/baremetal/example/xmac_test/sdkconfig.h +++ b/baremetal/example/xmac_test/sdkconfig.h @@ -76,7 +76,7 @@ /* Building Option */ -#define CONFIG_ENVI_UBUNTU_20_04 +#define CONFIG_ENVI_LINUX_X86_64 /* Cross-Compiler Setting */ @@ -109,7 +109,7 @@ /* Library Configuration */ -#define CONFIG_USE_LIBC +#define CONFIG_USE_G_LIBC /* end of Library Configuration */ /* Third-Party Configuration */ diff --git a/board/d2000/early_uart.c b/board/d2000/early_uart.c index e37315877..0262d2625 100644 --- a/board/d2000/early_uart.c +++ b/board/d2000/early_uart.c @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0. * * @Date: 2021-08-06 08:07:52 - * @LastEditTime: 2021-09-18 15:23:02 + * @LastEditTime: 2021-10-15 16:32:50 * @Description:  This files is for * * @Modify History: @@ -16,13 +16,6 @@ #include "parameters.h" #include "early_uart.h" -#define EARLY_UART_BASE FT_UART1_BASE_ADDR -#define EARLY_UART_UARTDR (EARLY_UART_BASE + 0x0) /* UART 数据寄存器地址 */ -#define EARLY_UART_UARTFR (EARLY_UART_BASE + 0x18) /* UART 状态寄存器地址 */ -#define EARLY_UART_TXFF BIT(5) /* 发送 FIFO 已满标志位 */ -#define EARLY_UART_RXFE BIT(4) /* 接收 FIFO 为空标志位 */ -#define EARLY_UART_DATA_MASK GENMASK(7, 0) - void OutByte(s8 byte) { /* wait until tx fifo is not full */ @@ -44,3 +37,4 @@ char GetByte(void) return (char)(EARLY_UART_DATA_MASK & FtIn32(EARLY_UART_UARTDR)); } + diff --git a/board/d2000/early_uart.h b/board/d2000/early_uart.h index c54993238..79e70d87a 100644 --- a/board/d2000/early_uart.h +++ b/board/d2000/early_uart.h @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0. * * @Date: 2021-08-06 08:07:52 - * @LastEditTime: 2021-10-12 21:54:30 + * @LastEditTime: 2021-10-15 17:19:40 * @Description:  This files is for * * @Modify History: @@ -20,6 +20,34 @@ extern "C" #endif #include "ft_types.h" +#include "kernel.h" +#include "parameters.h" + +#ifdef CONFIG_TARGET_EARY_UART0 +#define EARLY_UART_BASE FT_UART0_BASE_ADDR +#define EARLY_UART_IRQ_NUM FT_UART0_IRQ_NUMa +#else +#define EARLY_UART_BASE FT_UART1_BASE_ADDR +#define EARLY_UART_IRQ_NUM FT_UART1_IRQ_NUM +#endif // CONFIG_TARGET_EARY_UART1 + +#define EARLY_UART_UARTDR (EARLY_UART_BASE + 0x0) /* UART 数据寄存器地址 */ +#define EARLY_UART_UARTFR (EARLY_UART_BASE + 0x18) /* UART 状态寄存器地址 */ +#define EARLY_UART_UARTCR (EARLY_UART_BASE + 0x30) +#define EARLY_UART_UARTCR_UARTEN BIT(0) +#define EARLY_UART_UARTCR_TXE BIT(8) +#define EARLY_UART_UARTCR_RXE BIT(9) +#define EARLY_UART_UARTCR_INIT (EARLY_UART_UARTCR_UARTEN | EARLY_UART_UARTCR_TXE | \ + EARLY_UART_UARTCR_RXE) +#define EARLY_UART_UARTIMSC (EARLY_UART_BASE + 0x38) +#define EARLY_UART_UARTIMSC_RXIM BIT(4) +#define EARLY_UART_UARTIMSC_RTIM BIT(6) +#define EARLY_UART_UARTMIS (EARLY_UART_BASE + 0x40) +#define EARLY_UART_UARTICR (EARLY_UART_BASE + 0x44) +#define EARLY_UART_TXFF BIT(5) /* 发送 FIFO 已满标志位 */ +#define EARLY_UART_RXFE BIT(4) /* 接收 FIFO 为空标志位 */ +#define EARLY_UART_DATA_MASK GENMASK(7, 0) +#define EARLY_UART_RXI_MASK BIT(4) void OutByte(s8 byte); char GetByte(void); diff --git a/common/Kconfig b/common/Kconfig index 0c602035e..8f3e7d8d6 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -1,16 +1,4 @@ - -choice SDK_ENVI_TYPE - prompt "SDK Develope Platfrom" - default ENVI_UBUNTU_20_04 - help - SDK development host environment type. - - config ENVI_UBUNTU_20_04 - bool - prompt "Ubuntu 20.04 x85_64" -endchoice # SDK_ENVI_TYPE - menu "Cross-Compiler Setting" config COMPILER_NO_STD_STARUP bool "Non-Use GCC Provide Startup Files" diff --git a/configs/d2000_aarch32_amp_master_defconfig b/configs/d2000_aarch32_amp_master_defconfig index 511aeef77..76eb7c48f 100644 --- a/configs/d2000_aarch32_amp_master_defconfig +++ b/configs/d2000_aarch32_amp_master_defconfig @@ -68,7 +68,7 @@ CONFIG_ENABLE_Pl011_UART=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX_X86_64=y # # Cross-Compiler Setting @@ -105,7 +105,7 @@ CONFIG_STACK_SIZE=0x1000 # # Library Configuration # -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y # end of Library Configuration # diff --git a/configs/d2000_aarch32_amp_slave_defconfig b/configs/d2000_aarch32_amp_slave_defconfig index 89239fd12..c625c1421 100644 --- a/configs/d2000_aarch32_amp_slave_defconfig +++ b/configs/d2000_aarch32_amp_slave_defconfig @@ -75,7 +75,7 @@ CONFIG_ENABLE_Pl011_UART=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX_X86_64=y # # Cross-Compiler Setting @@ -112,7 +112,7 @@ CONFIG_STACK_SIZE=0x1000 # # Library Configuration # -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y # end of Library Configuration # diff --git a/configs/d2000_aarch32_defconfig b/configs/d2000_aarch32_defconfig index e819044a4..a8309dce4 100644 --- a/configs/d2000_aarch32_defconfig +++ b/configs/d2000_aarch32_defconfig @@ -52,7 +52,7 @@ CONFIG_EBABLE_GICV3=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX_X86_64=y # # Cross-Compiler Setting @@ -81,7 +81,7 @@ CONFIG_AARCH32_RAM_LD=y # # Library Configuration # -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y # end of Library Configuration # diff --git a/configs/d2000_aarch64_defconfig b/configs/d2000_aarch64_defconfig index bbbf53ac5..7aa405afe 100644 --- a/configs/d2000_aarch64_defconfig +++ b/configs/d2000_aarch64_defconfig @@ -62,7 +62,7 @@ CONFIG_ENABLE_Pl011_UART=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX_X86_64=y # # Cross-Compiler Setting @@ -99,7 +99,7 @@ CONFIG_STACK_TOP_ADDR=0x82000000 # # Library Configuration # -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y # end of Library Configuration # diff --git a/configs/e2000_aarch32_defconfig b/configs/e2000_aarch32_defconfig index 941984f37..bc5dbf470 100644 --- a/configs/e2000_aarch32_defconfig +++ b/configs/e2000_aarch32_defconfig @@ -50,7 +50,7 @@ CONFIG_ENABLE_Pl011_UART=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX_X86_64=y # # Cross-Compiler Setting @@ -80,7 +80,7 @@ CONFIG_AARCH32_RAM_LD=y # Library Configuration # # CONFIG_USE_NOSTD_LIBC is not set -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y # end of Library Configuration # diff --git a/configs/e2000_aarch64_defconfig b/configs/e2000_aarch64_defconfig index 14fa38810..1838caf54 100644 --- a/configs/e2000_aarch64_defconfig +++ b/configs/e2000_aarch64_defconfig @@ -50,7 +50,7 @@ CONFIG_ENABLE_Pl011_UART=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX_X86_64=y # # Cross-Compiler Setting @@ -80,7 +80,7 @@ CONFIG_AARCH64_RAM_LD=y # Library Configuration # # CONFIG_USE_NOSTD_LIBC is not set -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y # end of Library Configuration # diff --git a/configs/ft2004_aarch32_defconfig b/configs/ft2004_aarch32_defconfig index 8690c265e..2024ae61c 100644 --- a/configs/ft2004_aarch32_defconfig +++ b/configs/ft2004_aarch32_defconfig @@ -59,7 +59,7 @@ CONFIG_ENABLE_Pl011_UART=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX_X86_64=y # # Cross-Compiler Setting @@ -88,7 +88,7 @@ CONFIG_AARCH32_RAM_LD=y # # Library Configuration # -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y # end of Library Configuration # diff --git a/configs/ft2004_aarch64_defconfig b/configs/ft2004_aarch64_defconfig index 26fdcf532..b6d873d8f 100644 --- a/configs/ft2004_aarch64_defconfig +++ b/configs/ft2004_aarch64_defconfig @@ -53,7 +53,7 @@ CONFIG_EBABLE_GICV3=y # # Building Option # -CONFIG_ENVI_UBUNTU_20_04=y +CONFIG_ENVI_LINUX_X86_64=y # # Cross-Compiler Setting @@ -82,7 +82,7 @@ CONFIG_AARCH64_RAM_LD=y # # Library Configuration # -CONFIG_USE_LIBC=y +CONFIG_USE_G_LIBC=y # end of Library Configuration # diff --git a/doc/ChangeLog.md b/doc/ChangeLog.md index 416bc3b2e..f4eda99c6 100644 --- a/doc/ChangeLog.md +++ b/doc/ChangeLog.md @@ -1,3 +1,19 @@ +# Phytium Standalone SDK v0.1.6 ChangeLog + +Change Log since v0.1.5, 2021.10.19 + +## example + +- add project to demo usage of newlib + +## script + +- add `PHYTIUM_DEV_PATH` for all platforms +- install cross tool to `PHYTIUM_DEV_PATH` +- update GNU CC version to 10.3.1-2021.07 +- modify CC libc.a for printf issue +- merge newlib to CC tool + # Phytium Standalone SDK v0.1.5 ChangeLog Change Log since v0.1.4, 2021.10.14 diff --git a/install.py b/install.py index cb1a2ec17..a2a78f6cb 100755 --- a/install.py +++ b/install.py @@ -35,10 +35,6 @@ windows_msys2 = 2 ### environment constant sdk_profile_path = "/etc/profile.d/phytium_standalone_sdk.sh" -# argv[1]: online/offline -# print(sys.argv) -is_online = False - # check file attributes def is_readable(path, user): user_info = pwd.getpwnam(user) @@ -65,6 +61,7 @@ def is_executable(path, user): return (((s[stat.ST_UID] == uid) and (mode & stat.S_IXUSR > 0)) or ((s[stat.ST_GID] == gid) and (mode & stat.S_IXGRP > 0)) or (mode & stat.S_IXOTH > 0)) def un_tar(src_path, dst_dir): + print("- untar {} in progress...".format(src_path)) tar = tarfile.open(name=src_path) for member_info in tar.getmembers(): @@ -75,16 +72,8 @@ def un_tar(src_path, dst_dir): ################################################################# # STEP 1: Check environment -# check if it is offline install or online install -for i in range(1, len(sys.argv)): - if('-online' == sys.argv[i]) or ('-on' == sys.argv[i]) or ('-o' == sys.argv[i]): - is_online = True - -print("[1]: Online install" if is_online else "[1]: Offline install") # check install environment -install_platform = -1 - if (platform.system() == 'Linux' ) and (platform.processor() == 'x86_64'): install_platform = linux_x86 elif (platform.system() == 'Linux' ) and (platform.processor() == 'aarch64'): @@ -96,16 +85,12 @@ else: exit() # features for msys2 platform, windows platform do not support online -######################################### -if (install_platform == windows_msys2): - if (is_online == True): - print("[1]: Windows Msys2 do not support online install!!!") - exit() - - if (None == os.environ.get("PHYTIUM_DEV_PATH")): - print("[1]: Please set 'PHYTIUM_DEV_PATH' fisrt!!!") - exit() -######################################### +phytium_dev_path = os.environ.get("PHYTIUM_DEV_PATH") +# to compatible with Windows path, replace \\ with / +phytium_dev_path = '/'.join(phytium_dev_path.split('\\')) +if (None == phytium_dev_path): + print("[1]: Please set 'PHYTIUM_DEV_PATH' first!!!") + exit() # create '/etc/profile.d/phytium_standalone_sdk.sh' need sudo right, ask user to create it first if not os.path.exists(sdk_profile_path): @@ -168,37 +153,42 @@ os.system("sed -i '/export PATH=\$PATH:\$AARCH64_CROSS_PATH/d' " + old_profile_p os.system("sed -i '/export STANDALONE_SDK_ROOT=/d' " + old_profile_path) os.system("sed -i '/### PHYTIUM STANDALONE SDK SETTING END/d' "+ old_profile_path) +# remove environment variables +# os.system("sed -i '/### PHYTIUM STANDALONE SDK SETTING START/d' "+ sdk_profile_path) +# os.system("sed -i '/export AARCH32_CROSS_PATH=/d' " + sdk_profile_path) +# os.system("sed -i '/export PATH=\$PATH:\$AARCH32_CROSS_PATH/d' " + sdk_profile_path) +# os.system("sed -i '/export AARCH64_CROSS_PATH=/d' " + sdk_profile_path) +# os.system("sed -i '/export PATH=\$PATH:\$AARCH64_CROSS_PATH/d' " + sdk_profile_path) +# os.system("sed -i '/export STANDALONE_SDK_ROOT=/d' " + sdk_profile_path) +# os.system("sed -i '/### PHYTIUM STANDALONE SDK SETTING END/d' "+ sdk_profile_path) + print("[2]: Reset environment") -## STEP 3: install cross-platform compiler -cc_install_path = standalone_sdk_path + '/' + 'tools' + '/' +## STEP 3: get cross-platform compiler +cc_install_path = phytium_dev_path + '/' + 'cross_tool' + '/' # set cc package name, download url and install dst dir if (install_platform == linux_x86): - aarch32_cc = 'gcc-arm-x86_64-none-eabi-10-2020-q4-major' - aarch64_cc = 'gcc-arm-x86_64-aarch64-none-elf-10.2-2020.11' + + aarch32_cc = 'gcc-arm-10.3-2021.07-x86_64-arm-none-eabi' + aarch64_cc = 'gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf' # cc package name aarch32_cc_pack = aarch32_cc + '.tar.xz' aarch64_cc_pack = aarch64_cc + '.tar.xz' - aarch32_cc_url = 'https://gitee.com/phytium_embedded/phytium-standalone-sdk/attach_files/776847/download/gcc-arm-x86_64-none-eabi-10-2020-q4-major.tar.xz' - aarch64_cc_url = 'https://gitee.com/phytium_embedded/phytium-standalone-sdk/attach_files/776846/download/gcc-arm-x86_64-aarch64-none-elf-10.2-2020.11.tar.xz' - aarch32_cc_install_path = cc_install_path + aarch32_cc aarch64_cc_install_path = cc_install_path + aarch64_cc + elif (install_platform == linux_aarch64): - aarch32_cc = 'gcc-arm-aarch64-none-eabi-10-2020-q4-major' - aarch64_cc = 'gcc-arm-10.2-2020.11-aarch64-aarch64-none-elf' + aarch32_cc = 'gcc-arm-10.3-2021.07-aarch64-arm-none-eabi' + aarch64_cc = 'gcc-arm-10.3-2021.07-aarch64-aarch64-none-elf' # cc package name aarch32_cc_pack = aarch32_cc + '.tar.xz' aarch64_cc_pack = aarch64_cc + '.tar.xz' - aarch32_cc_url = 'https://gitee.com/phytium_embedded/phytium-standalone-sdk/attach_files/779742/download/gcc-arm-aarch64-none-eabi-10-2020-q4-major.tar.xz' - aarch64_cc_url = 'https://gitee.com/phytium_embedded/phytium-standalone-sdk/attach_files/779743/download/gcc-arm-10.2-2020.11-aarch64-aarch64-none-elf.tar.xz' - aarch32_cc_install_path = cc_install_path + aarch32_cc aarch64_cc_install_path = cc_install_path + aarch64_cc @@ -222,83 +212,51 @@ aarch32_cc_is_installed = os.path.exists(aarch32_cc_install_path) aarch64_cc_is_installed = os.path.exists(aarch64_cc_install_path) # cc download target -aarch32_cc_dl_dst = cc_install_path + aarch32_cc_pack -aarch64_cc_dl_dst = cc_install_path + aarch64_cc_pack +# aarch32_cc_dl_dst = cc_install_path + aarch32_cc_pack +# aarch64_cc_dl_dst = cc_install_path + aarch64_cc_pack + +aarch32_cc_dl_dst = phytium_dev_path + '/' + aarch32_cc_pack +aarch64_cc_dl_dst = phytium_dev_path + '/' + aarch64_cc_pack -# features for msys2 platform, copy cc package from DEV PATH to SDK PATH -######################################### -if (install_platform == windows_msys2) and (not os.path.exists(aarch32_cc_dl_dst)): - aarch32_cc_dev_path = os.environ.get('PHYTIUM_DEV_PATH') + '\\' + aarch32_cc_pack - if (os.path.exists(aarch32_cc_dev_path)): - print("[3] Copy AARCH32 CC from {}".format(aarch32_cc_dev_path)) - shutil.copy2(aarch32_cc_dev_path, aarch32_cc_dl_dst) - -if (install_platform == windows_msys2) and (not os.path.exists(aarch64_cc_dl_dst)): - aarch64_cc_dev_path = os.environ.get('PHYTIUM_DEV_PATH') + '\\' + aarch64_cc_pack - if (os.path.exists(aarch64_cc_dev_path)): - print("[3] Copy AARCH64 CC from {}".format(aarch32_cc_dev_path)) - shutil.copy2(aarch64_cc_dev_path, aarch64_cc_dl_dst) ######################################### +if not os.path.exists(aarch32_cc_dl_dst): + print("[3]: Failed, AARCH32 CC package {} non found !!!".format(aarch32_cc_dl_dst)) + exit() -if is_online: #online - import wget - - # download aarch32 cc package - if not aarch32_cc_is_installed: - print("[3] Download AARCH32 CC from {}...".format(aarch32_cc_url)) - cc_file = wget.download(aarch32_cc_url, aarch32_cc_dl_dst) - if not os.path.exists(cc_file) or not (cc_file == aarch32_cc_dl_dst): - print("[3]: Download AARCH32 CC failed!!!") - exit() - else: - print("[3]: Download AARCH32 CC at {}".format(aarch32_cc_dl_dst)) - - # download aarch64 cc package - if not aarch64_cc_is_installed: - print("[3] Download AARCH64 CC from {}...".format(aarch64_cc_url)) - cc_file = wget.download(aarch64_cc_url, aarch64_cc_dl_dst) - if not os.path.exists(cc_file) or not (cc_file == aarch64_cc_dl_dst): - print("[3]: Download AARCH64 CC failed!!!") - exit() - else: - print("[3]: Download AARCH64 CC at {}".format(aarch64_cc_dl_dst)) - -else: #offline, assert cc package exists - if not os.path.exists(aarch32_cc_dl_dst): - print("[3]: Failed, AARCH32 CC package {} non found !!!".format(aarch32_cc_dl_dst)) - exit() - - if not os.path.exists(aarch64_cc_dl_dst): - print("[3]: Failed, AARCH64 CC package {} non found !!!".format(aarch64_cc_dl_dst)) - exit() +if not os.path.exists(aarch64_cc_dl_dst): + print("[3]: Failed, AARCH64 CC package {} non found !!!".format(aarch64_cc_dl_dst)) + exit() +## STEP 4:install cc # untar aarch32 cc if not aarch32_cc_is_installed: if os.path.exists(aarch32_cc_dl_dst): - print("[3]: Install AARCH32 CC...") + print("[4]: Install AARCH32 CC...") un_tar(aarch32_cc_dl_dst, cc_install_path) # write aarch32 cc path if os.path.exists(aarch32_cc_install_path): - print("[3]: AARCH32 CC install success at {}".format(aarch32_cc_install_path)) + print("[4]: AARCH32 CC install success at {}".format(aarch32_cc_install_path)) else: - print("[3]: AARCH32 CC install failed !!!") + print("[4]: AARCH32 CC install failed !!!") exit() # untar aarch64 cc if not aarch64_cc_is_installed: if os.path.exists(aarch64_cc_dl_dst): - print("[3]: Install AARCH64 CC...") + print("[4]: Install AARCH64 CC...") un_tar(aarch64_cc_dl_dst, cc_install_path) # write aarch64 cc path if os.path.exists(aarch64_cc_install_path): - print("[3]: AARCH64 CC install success at {}".format(aarch64_cc_install_path)) + print("[4]: AARCH64 CC install success at {}".format(aarch64_cc_install_path)) else: - print("[3]: AARCH64 CC install failed !!!") + print("[4]: AARCH64 CC install failed !!!") exit() -## STEP 4: write environment variables +print("[4]: GNU CC version: 10.3.1-2021.07") + +## STEP 5: write environment variables os.environ['STANDALONE_SDK_ROOT'] = standalone_sdk_path os.environ['AARCH32_CROSS_PATH'] = aarch32_cc_install_path os.environ['AARCH64_CROSS_PATH'] = aarch64_cc_install_path diff --git a/lib/Kconfig b/lib/Kconfig index c6f5c3d9c..c482ee1ad 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -1,12 +1,17 @@ choice - prompt "StdLibC or NonStdLibC" - default USE_LIBC + prompt "Select C Standard Library" + default USE_G_LIBC - - config USE_LIBC - bool "Use C Standard Library" + config USE_G_LIBC + bool "Use GLibC" select USE_CACHE + config USE_NEW_LIBC + bool "Use NewLibC" + + #config USE_NOSTD_LIBC + # bool "Use NoStdLbC" + endchoice diff --git a/lib/lib.mk b/lib/lib.mk index 927db06a0..26f2dbb2f 100644 --- a/lib/lib.mk +++ b/lib/lib.mk @@ -3,15 +3,12 @@ LIB_CUR_DIR := $(STANDALONE_DIR)/lib -ifdef CONFIG_USE_LIBC -SRC_DIR += $(LIB_CUR_DIR)/libc -INC_DIR += $(LIB_CUR_DIR)/libc +ifneq ($(CONFIG_USE_G_LIBC)_$(CONFIG_USE_NEW_LIBC), 0_0) + SRC_DIR += $(LIB_CUR_DIR)/libc + INC_DIR += $(LIB_CUR_DIR)/libc endif ifdef CONFIG_USE_NOSTD_LIBC -SRC_DIR += $(LIB_CUR_DIR)/nostdlib -INC_DIR += $(LIB_CUR_DIR)/nostdlib -endif - - - + SRC_DIR += $(LIB_CUR_DIR)/nostdlib + INC_DIR += $(LIB_CUR_DIR)/nostdlib +endif \ No newline at end of file diff --git a/make/complier.mk b/make/complier.mk index ec918552d..6a4f125d4 100755 --- a/make/complier.mk +++ b/make/complier.mk @@ -90,6 +90,12 @@ define EOL = endef +ifdef CONFIG_DUMMY_COMPILE + DO_ECHO = @echo +else + DO_ECHO = +endif + RM_FILES = $(foreach file,$(1),rm -f $(file)$(EOL)) RM_DIRS = $(foreach dir,$(1),rm -rf $(dir)$(EOL)) @@ -99,27 +105,7 @@ CPPFLAGS = $(DEFINES) $(INCLUDES) $(DEPEND_FLAGS) $(CPPFLAGS_EXTRA) CFLAGS = $(DEBUG_FLAGS) -DGUEST -ffreestanding -Wextra -g -O$(OPT_LEVEL) -lnosys #-Wall ASFLAGS = $(CFLAGS) -LIBC ?= -LIBPATH ?= -ifdef CONFIG_TARGET_ARMV8_AARCH32 - LIBPATH += $(CROSS_PATH)/arm-none-eabi/lib/thumb/v7/nofp -# support float and div, turn on by default for aarch64 -mfpu=crypto-neon-fp-armv8。 - ASFLAGS := $(ASFLAGS) -mfpu=crypto-neon-fp-armv8 -ftree-vectorize -mfloat-abi=softfp -ffast-math -fsingle-precision-constant -march=$(ARCH) - CFLAGS := $(CFLAGS) -mfpu=crypto-neon-fp-armv8 -mfloat-abi=softfp -march=$(ARCH) -endif - -ifdef CONFIG_TARGET_ARMV8_AARCH64 - CROSS_PATH := $(AARCH64_CROSS_PATH) -endif - -LDFLAGS = -Wl,--build-id=none -ifdef CONFIG_USE_LIBC -ifdef CONFIG_TARGET_ARMV8_AARCH32 -LDFLAGS += -lgcc -L $(LIBPATH) -endif -else -LDFLAGS += -nostdlib -nostartfiles -endif +#LIBC ?= TARGET_ARCH = -march=$(ARCH) @@ -135,14 +121,52 @@ OBJ_FILES := $(patsubst %, $(OUTPUT_DIR)/%, $(APP_S_SRC:.S=.o)) \ EXCL_OBJS ?= $(patsubst %, $(OUTPUT_DIR)/%, $(EXCL_SRC:.c=.o)) OBJ_FILES := $(filter-out $(EXCL_OBJS), $(OBJ_FILES)) -OBJ_FILES += $(LIBC) +#OBJ_FILES += $(LIBC) DEP_FILES := $(OBJ_FILES:%=%.d) -ifdef CONFIG_DUMMY_COMPILE - DO_ECHO = @echo -else - DO_ECHO = +LIBPATH ?= +CC_VERSION = 10.3.1 +ifdef CONFIG_TARGET_ARMV8_AARCH32 + # support float and div, turn on by default for aarch64 -mfpu=crypto-neon-fp-armv8。 + ASFLAGS := $(ASFLAGS) -mfpu=crypto-neon-fp-armv8 -ftree-vectorize -mfloat-abi=softfp -ffast-math -fsingle-precision-constant -march=$(ARCH) + CFLAGS := $(CFLAGS) -mfpu=crypto-neon-fp-armv8 -mfloat-abi=softfp -march=$(ARCH) +endif + +# 使用编译链自带的Glibc +ifdef CONFIG_USE_G_LIBC + ifdef CONFIG_TARGET_ARMV8_AARCH32 + LIBPATH += $(CROSS_PATH)/arm-none-eabi/lib/thumb/v7/nofp + 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)/lib/gcc/arm-none-eabi/$(CC_VERSION)/libgcc.a + endif +endif + +# 使用外链的NewLibc +ifdef CONFIG_USE_NEW_LIBC + ifdef CONFIG_TARGET_ARMV8_AARCH32 + 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)/lib/gcc/arm-none-eabi/$(CC_VERSION)/libgcc.a + endif + + ifdef CONFIG_TARGET_ARMV8_AARCH64 + 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)/lib/gcc/aarch64-none-elf/$(CC_VERSION)/libgcc.a + endif + + LDFLAGS += -nostdlib -nostartfiles + LDFLAGS += -lgcc -L $(LIBPATH) +endif + +# 不使用Libc库 +ifdef CONFIG_USE_NOSTD_LIBC + LDFLAGS += -nostdlib -nostartfiles endif .phony: all linkscript clean rebuild @@ -188,9 +212,6 @@ clean: $(call RM_FILES,*.map) $(call RM_FILES,*.tar.gz) - - - # Make sure everything is rebuilt if this makefile is changed $(OBJ_FILES) $(APP): makefile diff --git a/make/ld/Kconfig b/make/ld/Kconfig index 4f265b7f7..b831ac842 100644 --- a/make/ld/Kconfig +++ b/make/ld/Kconfig @@ -82,7 +82,7 @@ menu "Linker Options" config HEAP_SIZE hex "Heap Size" - default "0x0400" + default "0x04000" help Assign Heap size in Linkscript diff --git a/run_mingw64.cmd b/run_mingw64.cmd deleted file mode 100644 index 409e4e512..000000000 --- a/run_mingw64.cmd +++ /dev/null @@ -1,2 +0,0 @@ -%PHYTIUM_DEV_PATH%\msys64\msys2_shell.cmd -where %CD% -msys2 -shell bash -pause \ No newline at end of file diff --git a/run_tftd.cmd b/run_tftd.cmd deleted file mode 100644 index 73d5e6fe2..000000000 --- a/run_tftd.cmd +++ /dev/null @@ -1,2 +0,0 @@ -%PHYTIUM_DEV_PATH%\tftp\tftpd64_gui.exe -pause \ No newline at end of file diff --git a/scripts/compress.md b/scripts/compress.md index d8886251c..2001292d3 100644 --- a/scripts/compress.md +++ b/scripts/compress.md @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0. * * @Date: 2021-07-22 11:46:04 - * @LastEditTime: 2021-10-12 18:51:28 + * @LastEditTime: 2021-10-18 15:36:46 * @Description:  This files is for * * @Modify History: @@ -16,7 +16,8 @@ - 将文件夹xxx压缩成tar.xz格式 ```shell tar -cvf xxx.tar xxx # 生成xxx.tar文件 -xz -z xxx.tar # 生成xxx.tar.xz文件, 耗时较长,压缩效率高 +xz -z -k 8 xxx.tar # 生成xxx.tar.xz文件, 耗时较长,压缩效率高 +tar -Jcvf xxx.tar.xz xxx ``` - 解压缩tar.xz文件 diff --git a/scripts/update_dev_path.sh b/scripts/update_dev_path.sh new file mode 100644 index 000000000..f045819d1 --- /dev/null +++ b/scripts/update_dev_path.sh @@ -0,0 +1,27 @@ +### + # @ : Copyright (c) 2021 Phytium Information Technology, Inc. + # + # SPDX-License-Identifier: Apache-2.0. + # + # @Date: 2021-10-19 08:10:14 + # @LastEditTime: 2021-10-19 08:29:14 + # @Description:  This files is for + # + # @Modify History: + # Ver   Who        Date         Changes + # ----- ------     --------    -------------------------------------- +### +# 指定sdk profle文件 +export sdk_profile=/etc/profile.d/phytium_standalone_sdk.sh +# 检查sdk profile文件是否存在 +ls $sdk_profile -l +# 删除profile文件可能存在的DEV目录 +sudo sed -i "/export PHYTIUM_DEV_PATH=/d" $sdk_profile +# 将PHYTIUM_DEV_PATH记录在Profile中 +echo "export PHYTIUM_DEV_PATH=/mnt/d/phytium-dev" >> $sdk_profile +# 检查DEV目录环境变量是否已定义 +cat $sdk_profile | grep PHYTIUM_DEV_PATH +# 在当前控制台窗口中生效PHYTIUM_DEV_PATH +source $sdk_profile +# 检查DEV目录 +echo $PHYTIUM_DEV_PATH \ No newline at end of file diff --git a/third-party/Kconfig b/third-party/Kconfig index 504ee022f..1880577c8 100644 --- a/third-party/Kconfig +++ b/third-party/Kconfig @@ -1,6 +1,6 @@ # config USE_COREMARK # bool -# depends on USE_LIBC +# depends on USE_G_LIBC # prompt "Use Coremark" # help # Include Coremark for Benchmark