Browse Source

!119 支持在 Windows Prompt 下进行开发和调试

pull/120/head
zhugengyu 10 months ago
parent
commit
822fc36aff
  1. 16
      doc/ChangeLog.md
  2. BIN
      doc/fig/add_path_for_win.png
  3. BIN
      doc/fig/admin_rights.png
  4. BIN
      doc/fig/check_env_for_win.png
  5. BIN
      doc/fig/config_tftp32.png
  6. BIN
      doc/fig/install_for_mingw.png
  7. BIN
      doc/fig/install_msys2.png
  8. BIN
      doc/fig/installing_msys2.png
  9. BIN
      doc/fig/setup_win.png
  10. BIN
      doc/fig/tftp32_srv.png
  11. BIN
      doc/fig/update_packman.png
  12. BIN
      doc/fig/windows_clone.png
  13. BIN
      doc/fig/windows_compile.png
  14. BIN
      doc/fig/windows_compile_output.png
  15. BIN
      doc/fig/windows_env_check.png
  16. BIN
      doc/fig/windows_jtag_connect.jpg
  17. BIN
      doc/fig/windows_jtag_drvier.png
  18. BIN
      doc/fig/windows_jtag_upload.png
  19. BIN
      doc/fig/windows_load_defconfig.png
  20. BIN
      doc/fig/windows_menuconfig.png
  21. BIN
      doc/fig/windows_native_env.png
  22. BIN
      doc/fig/windows_terminal_output.png
  23. BIN
      doc/fig/windows_tftpupload.png
  24. BIN
      doc/fig/windows_tools_check.png
  25. 40
      doc/reference/sdk_reference.md
  26. 177
      doc/reference/usr/install_windows.md
  27. 62
      example/system/cxx/cryptopp/sdkconfig
  28. 59
      example/system/cxx/cryptopp/sdkconfig.h
  29. 0
      example/system/jtag_debugging/.aarch32_mode_change
  30. 11
      example/system/jtag_debugging/README.md
  31. 9
      example/system/jtag_debugging/makefile
  32. 5
      lib/libc/system_call.c
  33. 7
      tools/build/menuconfig/preconfig.mk
  34. 3
      tools/debugging/run_openocd_dap.bat
  35. 13
      tools/debugging/run_openocd_dap.sh
  36. 3
      tools/debugging/run_openocd_jlink.bat
  37. 13
      tools/debugging/run_openocd_jlink.sh

16
doc/ChangeLog.md

@ -1,3 +1,19 @@
# Phytium Standalone SDK 2024-01-12 ChangeLog
Change Log since 2024-01-10
## example
- example/system/jtag_debugging add support for windows shell
## tools
- add openocd script for windows shell
## doc
- add readme for windows shell environtment install and usage
# Phytium Standalone SDK 2024-01-10 ChangeLog
Change Log since 2024-01-08

BIN
doc/fig/add_path_for_win.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

BIN
doc/fig/admin_rights.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

BIN
doc/fig/check_env_for_win.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

BIN
doc/fig/config_tftp32.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

BIN
doc/fig/install_for_mingw.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

BIN
doc/fig/install_msys2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

BIN
doc/fig/installing_msys2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

BIN
doc/fig/setup_win.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

BIN
doc/fig/tftp32_srv.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

BIN
doc/fig/update_packman.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

BIN
doc/fig/windows_clone.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
doc/fig/windows_compile.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

BIN
doc/fig/windows_compile_output.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

BIN
doc/fig/windows_env_check.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

BIN
doc/fig/windows_jtag_connect.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

BIN
doc/fig/windows_jtag_drvier.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
doc/fig/windows_jtag_upload.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 KiB

BIN
doc/fig/windows_load_defconfig.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

BIN
doc/fig/windows_menuconfig.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
doc/fig/windows_native_env.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

BIN
doc/fig/windows_terminal_output.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

BIN
doc/fig/windows_tftpupload.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

BIN
doc/fig/windows_tools_check.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

40
doc/reference/sdk_reference.md

@ -1,40 +0,0 @@
# SDK参考手册
`SDK参考手册模板`
- 版本:v0.1
## 1. SDK用户指南
`提供使用API过程中可能遇到的问题,按照用户使用的一般顺序排列`
### 1.1 配套目标平台
### 1.2 使用构建系统
### 1.3 使用驱动组件
### 1.4 生成链接器脚本
### 1.5 完成引导加载
### 1.6 处理API错误码
## 2. 组件使用指南
`提供分模块的具体API说明,按照模块分类说明,模块内按照字母顺序排列,方便检索`
### I2C
[](./driver/fi2c.md)
## 3. 硬件使用指南
`提供硬件平台的参考资料,按字母顺序排列`
### D2000
### E2000
### FT2000/4

177
doc/reference/usr/install_windows.md

@ -1,144 +1,145 @@
# 1. Windows10 SDK安装方法
# Windows 环境下的 SDK 开发方法
Windows 10 SDK开发环境集成了,
- `msys64`,Msys2 portable环境, 主要提供Windows上的shell命令行开发环境,包括了Cygwin (POSIX 兼容性层) 和 MinGW-w64(从"MinGW-生成")
- `setup_dev.py`, 安装脚本,主要的功能包括创建sdk的profile文件,创建`PHYTIUM_DEV_PATH`环境变量,通过git拉取SDK源码,以及完成SDK安装
- `gcc-arm-10.3-2021.07-mingw-w64-i686-aarch64-none-elf.tar.xz`和`gcc-arm-10.3-2021.07-mingw-w64-i686-arm-none-eabi.tar.xz`, mingw64交叉编译链, SDK安装过程中会被解压到DEV目录的`cross_tool`目录下
- `tftp`, tftp工具, 提供tftp服务,用于开发板下载二进制镜像文件,主要的功能包括安装tftp32服务和配置tftp目录
- `run_msys2.cmd`,用于打开和配置msys2 shell的脚本,需要设置`PHYTIUM_DEV_PATH`后才能使用
- `run_tftd.cmd`,用于打开tftpd工具的脚本,需要设置`PHYTIUM_DEV_PATH`后才能使用
- `tftp/reinstall.cmd`, 用于安装和配置tftpd服务的脚本
- `tftp/uninstall.cmd`, 用于卸载tftpd服务的脚本
- 本工具提供了 Phytium RTOS SDK 的 Windows 开发环境,在 64 位 Windows 10/11 上完成测试
## 1.1 获取SDK的开发环境
![Alt text](../../fig/windows_native_env.png)
- [Windows10](https://pan.baidu.com/s/1V96isNcPq4F7nKi3_8GoGg)
>提取码:WX64
- 本工具支持
- 1. [Phytium Standalone SDK](https://gitee.com/phytium_embedded/phytium-standalone-sdk)
- 2. [Phytium FreeRTOS SDK](https://gitee.com/phytium_embedded/phytium-free-rtos-sdk)
- Windows环境下可以用通用的unzip工具解压,如7zip和winrar
- 本工具包集成了,
- 1. AARCH64 交叉编译链 xpack-aarch64-none-elf-gcc-11.3.1-1.2,来自 https://github.com/xpack-dev-tools/aarch64-none-elf-gcc-xpack/releases/
- 2. AARCH32 交叉编译链 xpack-arm-none-eabi-gcc-11.3.1-1.1,来自 https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/
- 3. busybox 工具包 xpack-windows-build-tools-4.3.0-1,来自 https://github.com/xpack-dev-tools/windows-build-tools-xpack/releases/
- 4. CMake 工具 xpack-cmake-3.25.3-1,来自 https://github.com/xpack-dev-tools/cmake-xpack/releases/
- 5. Ninja 工具 xpack-ninja-build-1.11.1-2,来自 https://github.com/xpack-dev-tools/ninja-build-xpack/releases/
- 6. Git 工具 PortableGit,来自 https://github.com/git-for-windows/git/releases/download/v2.43.0.windows.1/PortableGit-2.43.0-32-bit.7z.exe
- 7. OpenOCD 工具,基于 OpenOCD 0.12.0 开发,支持 Phytium 系列 CPU 的调试
- 8. Python 3.8 工具,来自 https://www.python.org/ftp/python/3.8.0/python-3.8.0-embed-win32.zip,下载 [get-pip.py](https://bootstrap.pypa.io/get-pip.py) ,额外安装了 pip工具和 windows-curses 包
## 1.2 安装SDK开发环境
```
python get-pip.py
python -m pip install windows-curses
```
- (1). 添加Windows环境变量,`PHYTIUM_DEV_PATH`(环境变量名**不能自定义**),例如,指向文件夹`E:\phytium-dev-windows-nt`(可以自定义)
- 9. GDB-Multiarch 工具,来自 https://static.grumpycoder.net/pixel/gdb-multiarch-windows/
- 10. TFTP 工具,来自 https://bitbucket.org/phjounin/tftpd64/downloads/
![配置环境变量](../../fig/add_path_for_win.png)
## 使用方法
- (2). 进入DEV目录,双击脚本`run_msys2.cmd`, 进入msys2控制台, 运行`./setup_dev.py`,注册开发环境
- (1)从百度网盘链接下载获取开发环境,下载完成后双击 phytium-rtos-dev-tools.exe 解压到指定目录
![安装开发环境](../../fig/install_for_mingw.png)
- [Windows 10/11 x64 环境下载链接](https://pan.baidu.com/s/1J7dndPqMtQD1RNmfdVHblQ)
>提取码:phyt
- (3). 安装完成后重启系统,或者关闭当前终端,新开一个终端继续后面的操作
- (4). DEV目录注册完成后,通过git拉取Phytium Standalone SDK的代码,如
- (2)进入 phytium-rtos-dev-tools 目录,双击 terminal.cmd 打开控制台,后续的操作都在这个控制台中进行
- (3)通过git拉取Phytium Standalone SDK的代码,如
```
git clone https://gitee.com/phytium_embedded/phytium-standalone-sdk.git ./phytium-standalone-sdk
```
- (5). 进入Phytium Standalone SDK代码目录,运行`./install.py`
![Alt text](../../fig/windows_clone.png)
```
cd ./phytium-standalone-sdk
./install.py
```
- (4) 进入Phytium Standalone SDK代码目录,选择一个 example 进行编译开发,例如使用 letter shell 例程,目标平台为 E2000D Demo 板,首先加载默认配置
![开发环境安装完成](../../fig/setup_win.png)
```
cd phytium-standalone-sdk\example\system\letter_shell_test
make list_kconfig
make load_kconfig LOAD_CONFIG_NAME=e2000d_aarch64_demo_shell
```
![Alt text](../../fig/windows_load_defconfig.png)
### Q: 如果当前环境无法连接互联网
- (5)如果需要进行配置的话,可以进入 menuconfig 界面
- 在执行第(2)步前,需要手动下载Phytium Standalone SDK,放置在DEV目录下
```
make menuconfig
```
- https://gitee.com/phytium_embedded/phytium-standalone-sdk
![Alt text](../../fig/windows_menuconfig.png)
![手动下载SDK](../../fig/git_url.png)
- (6) 配置完成之后进行编译
## 1.3 检查安装是否成功
```
make clean
make all
```
- 打印下列环境变量,观察各变量是否存在,指向的目录是否正确
>`PHYTIUM_DEV_PATH`指向DEV目录
![Alt text](../../fig/windows_compile.png)
>`AARCH32_CROSS_PATH`指向32位交叉编译链目录
- (7) 编译成功后可以看到生成的镜像,然后拷贝镜像到上传路径,如 d:\tftpboot
>`AARCH64_CROSS_PATH`指向64位交叉编译链目录
![Alt text](../../fig/windows_compile_output.png)
> 上传路径可以在例程 makefile 中通过修改 USR_BOOT_DIR 变量指定
```
echo $PHYTIUM_DEV_PATH $AARCH32_CROSS_PATH $AARCH64_CROSS_PATH
make image
```
- 环境变量打印正确无误,表示**安装成功**
## 1.4 Windows 10安装Msys2(可选)
- (8) 本环境中集成了 tftp 工具,可以支持通过网络将镜像下载到开发板,具体的使用方法是
- (1). 获取[Windows环境安装包](https://pan.baidu.com/s/17WX5hec7t8_ubAKzFCwQAA)
>提取码:MGW6
```
1. 固定电脑端网卡的 ip 地址(如 192.168.4.30),手动设置电脑端网卡的 ip 地址,或者通过路由器设置绑定 ip
2. 通过网线连接开发板和设置了固定 ip 地址的电脑端网卡
3. 在电脑端运行 tftp64.exe,将 tftp 目录指向*.bin 或 *.elf 镜像 (baremetal.elf)所在的位置
4. 启动开发板停留在 u-boot 控制台界面,然后通过串口工具输入下列命令
- 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`
setenv ipaddr 192.168.4.20
setenv serverip 192.168.4.30
setenv gatewayip 192.168.4.1
tftpboot 0x90100000 baremetal.elf
bootelf -p 0x90100000
```
- (2). 创建Windows集成开发环境(DEV目录),如`D:/phytium-dev`, 将DEV目录添加在Windows环境变量中,变量名为`PHYTIUM_DEV_PATH`,如下图所示,保存环境变量,
>对于Windows 10,在桌面左下角系统搜索框中输入“环境变量”即可进入环境变量编辑界面
- 可以使用开源串口工具 [WindTerm](https://github.com/kingToolbox/WindTerm) 连接开发板
>DEV目录中不要留空格
![输入图片说明](../../fig/add_path_for_win.png)
![Alt text](../../fig/windows_tftpupload.png)
- (3). 保存DEV环境变量后,打开一个控制台,输入`echo %PHYTIUM_DEV_PATH%`,检查环境变量是否设置成功,
![输入图片说明](../../fig/check_env_for_win.png)
![Alt text](../../fig/windows_terminal_output.png)
- (4). 双击`msys2-x86_64-20210725.exe`,设置`Msys2`的安装路径在DEV路径下,其余设置按默认安装,注意安装完成后不要马上启动,最后一步取消勾选“马上启动Msys2”
![输入图片说明](../../fig/install_msys2.png)
- (9) 本环境中集成了 JTAG OpenOCD 调试工具,可以支持 AARCH64 和 AARCH32 调试,具体使用方法可以参考[JTAG 调试例程](https://gitee.com/phytium_embedded/phytium-standalone-sdk/tree/master/example/system/jtag_debugging)
![Msys2安装过程](../../fig/installing_msys2.png)
- 首先使用 JTAG 适配器连接电脑端和开发板,我们这里使用的是 FireDAP,使用 OpenOCD 的话,需要参考原理图,连接 TDI TDO TMS 和 TCK 四根线
- (5). `Msys2`安装完成后,需要添加国内软件源,否则下载速度会很慢,进入`D:\phytium-dev\msys64\etc\pacman.d`目录下,找到以下三个文件,在文件末尾分别添加对应的软件源
![Alt text](../../fig/windows_jtag_connect.jpg)
- mirrorlist.mingw32
- 双击 terminal.cmd 两次创建两个窗口,一个窗口运行 OpenOCD,另一个窗口运行 GDB,其中,运行 OpenOCD 的窗口输入下列命令,启动 OpenOCD 进程
```
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/i686
cd phytium-standalone-sdk\example\system\jtag_debugging
make run_openocd
```
- mirrorlist.mingw64
- 等待 OpenOCD 进程启动完成后, 运行 GDB 的窗口输入下列命令,启动 GDB 调试进程,连接 OpenOCD 进程,后续的调试作业可以在这个窗口完成
```
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/x86_64
cd phytium-standalone-sdk\example\system\jtag_debugging
make run_gdb
```
- mirrorlist.msys
> 调试适配器支持 Jlink 和 CMSIS DAP,可以在 example 的 makefile 中通过修改 OPENOCD_CMD 指定是使用 Jlink 还是 CMSIS DAP
```
Server = https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/$arch
```
![Alt text](../../fig/windows_jtag_upload.png)
- (6). 进入`D:\phytium-dev\msys64`目录,双击`msys2_shell.cmd`启动运行`Msys2`,输入以下命令,更新`Msys2`软件,安装必要组件
## 注意事项
>如果执行失败,可以多次尝试,直到没有报错
- 1. 运行 terminal.cmd 会自动设置环境变量,后续的操作都必须在 terminal.cmd 弹出的控制台中进行,可以通过下列方法验证环境是否可以工作
>安装过程全部选用默认方式`default`或选择`y`,注意如果没有`default = all`,需要输入`y`
```
$ pacman -Syu
$ pacman -S mingw-w64-x86_64-toolchain
$ pacman -S base-devel git python3 python3-pip
```
![更新Msys2软件源](../../fig/update_packman.png)
- (7). 运行以下命令,检查组件是否安装完全
```
$ pacman -Q make git wget python3 python3-pip
```
```
aarch64-none-elf-gcc --version
arm-none-eabi-gcc --version
openocd --version
make --version
```
## 1.5 卸载开发环境
![](../../fig/windows_env_check.png)
- 在DEV目录下双击`run_msys2.cmd`, 启动`Msys2`控制台,在控制台输入`./uninstall.py`完成SDK卸载
- 2. JTAG 适配器驱动问题,使用 Jlink 或者 FireDAP 要使用 WinUSB 的驱动不要使用官方的驱动,具体修改方法是在设备管理器里卸载官方驱动,然后用 Zadig 工具将设备驱动换成 WinUSB, OpenOCD 中会将 Jlink 当作一个普通的 USB Bulk 设备,将 CMSIS DAP 当成一个 USB Hid 设备进行通信
- 在`Msys2`控制台运行`rm /etc/profile.d/phytium_standalone_sdk.sh`,删除SDK配置文件
![Alt text](../../fig/windows_jtag_drvier.png)
- 在DEV目录`D:\phytium-dev\tftp`下以**管理员权限**打开Windows命令行中断,运行`uninstall.cmd`完成Tftd卸载
- 3. 部分 Windows 中存在环境问题,有些 Windows 环境中已经之前已经安装了 MINGW 或者 Cygwin 等工具,必须确保编译环境中使用的是 xpack-windows-build-tools 里提供的 busybox 工具
- 重启系统完成卸载
![Alt text](../../fig/windows_tools_check.png)

62
example/system/cxx/cryptopp/sdkconfig

@ -9,8 +9,8 @@ CONFIG_ARCH_NAME="armv8"
#
# Arm architecture configuration
#
CONFIG_ARCH_ARMV8_AARCH64=y
# CONFIG_ARCH_ARMV8_AARCH32 is not set
# CONFIG_ARCH_ARMV8_AARCH64 is not set
CONFIG_ARCH_ARMV8_AARCH32=y
#
# Compiler configuration
@ -18,21 +18,27 @@ CONFIG_ARCH_ARMV8_AARCH64=y
CONFIG_ARM_GCC_SELECT=y
# CONFIG_ARM_CLANG_SELECT is not set
CONFIG_TOOLCHAIN_NAME="gcc"
CONFIG_TARGET_ARMV8_AARCH64=y
CONFIG_ARCH_EXECUTION_STATE="aarch64"
CONFIG_ARM_NEON=y
CONFIG_ARM_CRC=y
CONFIG_ARM_CRYPTO=y
CONFIG_ARM_FLOAT_POINT=y
# CONFIG_GCC_CODE_MODEL_TINY is not set
CONFIG_GCC_CODE_MODEL_SMALL=y
# CONFIG_GCC_CODE_MODEL_LARGE is not set
CONFIG_TARGET_ARMV8_AARCH32=y
CONFIG_ARCH_EXECUTION_STATE="aarch32"
#
# Fpu configuration
#
CONFIG_CRYPTO_NEON_FP_ARMV8=y
# CONFIG_VFPV4 is not set
# CONFIG_VFPV4_D16 is not set
# CONFIG_VFPV3 is not set
# CONFIG_VFPV3_D16 is not set
CONFIG_ARM_MFPU="crypto-neon-fp-armv8"
CONFIG_MFLOAT_ABI_HARD=y
# CONFIG_MFLOAT_ABI_SOFTFP is not set
CONFIG_ARM_MFLOAT_ABI="hard"
# end of Fpu configuration
# end of Compiler configuration
CONFIG_USE_CACHE=y
CONFIG_USE_MMU=y
CONFIG_BOOT_WITH_FLUSH_CACHE=y
# CONFIG_MMU_DEBUG_PRINTS is not set
CONFIG_USE_AARCH64_L1_TO_AARCH32=y
CONFIG_FPEN=y
# end of Arm architecture configuration
# end of Arch configuration
@ -40,14 +46,15 @@ CONFIG_FPEN=y
#
# Soc configuration
#
CONFIG_TARGET_PHYTIUMPI=y
# CONFIG_TARGET_PHYTIUMPI is not set
# CONFIG_TARGET_E2000Q is not set
# CONFIG_TARGET_E2000D is not set
CONFIG_TARGET_E2000D=y
# CONFIG_TARGET_E2000S is not set
# CONFIG_TARGET_FT2004 is not set
# CONFIG_TARGET_D2000 is not set
CONFIG_SOC_NAME="phytiumpi"
CONFIG_SOC_CORE_NUM=4
CONFIG_SOC_NAME="e2000"
CONFIG_TARGET_TYPE_NAME="d"
CONFIG_SOC_CORE_NUM=2
CONFIG_F32BIT_MEMORY_ADDRESS=0x80000000
CONFIG_F32BIT_MEMORY_LENGTH=0x80000000
CONFIG_F64BIT_MEMORY_ADDRESS=0x2000000000
@ -62,21 +69,22 @@ CONFIG_DEFAULT_DEBUG_PRINT_UART1=y
#
# Board Configuration
#
CONFIG_BOARD_NAME="firefly"
CONFIG_E2000D_DEMO_BOARD=y
CONFIG_BOARD_NAME="demo"
#
# IO mux configuration when board start up
#
# CONFIG_USE_SPI_IOPAD is not set
# CONFIG_USE_GPIO_IOPAD is not set
# CONFIG_USE_CAN_IOPAD is not set
# CONFIG_USE_QSPI_IOPAD is not set
# CONFIG_USE_PWM_IOPAD is not set
# CONFIG_USE_ADC_IOPAD is not set
# CONFIG_USE_MIO_IOPAD is not set
# CONFIG_USE_TACHO_IOPAD is not set
# CONFIG_USE_UART_IOPAD is not set
# CONFIG_USE_THIRD_PARTY_IOPAD is not set
CONFIG_FIREFLY_DEMO_BOARD=y
#
# IO mux configuration when board start up
#
# end of IO mux configuration when board start up
# CONFIG_CUS_DEMO_BOARD is not set
@ -226,7 +234,11 @@ CONFIG_DEFAULT_LINKER_SCRIPT=y
CONFIG_IMAGE_LOAD_ADDRESS=0x80100000
CONFIG_IMAGE_MAX_LENGTH=0x1000000
CONFIG_HEAP_SIZE=1
CONFIG_STACK_SIZE=0x400
CONFIG_FPU_STACK_SIZE=0x1000
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 Build setup

59
example/system/cxx/cryptopp/sdkconfig.h

@ -10,42 +10,48 @@
/* Arm architecture configuration */
#define CONFIG_ARCH_ARMV8_AARCH64
/* CONFIG_ARCH_ARMV8_AARCH32 is not set */
/* CONFIG_ARCH_ARMV8_AARCH64 is not set */
#define CONFIG_ARCH_ARMV8_AARCH32
/* Compiler configuration */
#define CONFIG_ARM_GCC_SELECT
/* CONFIG_ARM_CLANG_SELECT is not set */
#define CONFIG_TOOLCHAIN_NAME "gcc"
#define CONFIG_TARGET_ARMV8_AARCH64
#define CONFIG_ARCH_EXECUTION_STATE "aarch64"
#define CONFIG_ARM_NEON
#define CONFIG_ARM_CRC
#define CONFIG_ARM_CRYPTO
#define CONFIG_ARM_FLOAT_POINT
/* CONFIG_GCC_CODE_MODEL_TINY is not set */
#define CONFIG_GCC_CODE_MODEL_SMALL
/* CONFIG_GCC_CODE_MODEL_LARGE is not set */
#define CONFIG_TARGET_ARMV8_AARCH32
#define CONFIG_ARCH_EXECUTION_STATE "aarch32"
/* Fpu configuration */
#define CONFIG_CRYPTO_NEON_FP_ARMV8
/* CONFIG_VFPV4 is not set */
/* CONFIG_VFPV4_D16 is not set */
/* CONFIG_VFPV3 is not set */
/* CONFIG_VFPV3_D16 is not set */
#define CONFIG_ARM_MFPU "crypto-neon-fp-armv8"
#define CONFIG_MFLOAT_ABI_HARD
/* CONFIG_MFLOAT_ABI_SOFTFP is not set */
#define CONFIG_ARM_MFLOAT_ABI "hard"
/* end of Fpu configuration */
/* end of Compiler configuration */
#define CONFIG_USE_CACHE
#define CONFIG_USE_MMU
#define CONFIG_BOOT_WITH_FLUSH_CACHE
/* CONFIG_MMU_DEBUG_PRINTS is not set */
#define CONFIG_USE_AARCH64_L1_TO_AARCH32
#define CONFIG_FPEN
/* end of Arm architecture configuration */
/* end of Arch configuration */
/* Soc configuration */
#define CONFIG_TARGET_PHYTIUMPI
/* CONFIG_TARGET_PHYTIUMPI is not set */
/* CONFIG_TARGET_E2000Q is not set */
/* CONFIG_TARGET_E2000D is not set */
#define CONFIG_TARGET_E2000D
/* CONFIG_TARGET_E2000S is not set */
/* CONFIG_TARGET_FT2004 is not set */
/* CONFIG_TARGET_D2000 is not set */
#define CONFIG_SOC_NAME "phytiumpi"
#define CONFIG_SOC_CORE_NUM 4
#define CONFIG_SOC_NAME "e2000"
#define CONFIG_TARGET_TYPE_NAME "d"
#define CONFIG_SOC_CORE_NUM 2
#define CONFIG_F32BIT_MEMORY_ADDRESS 0x80000000
#define CONFIG_F32BIT_MEMORY_LENGTH 0x80000000
#define CONFIG_F64BIT_MEMORY_ADDRESS 0x2000000000
@ -59,20 +65,21 @@
/* Board Configuration */
#define CONFIG_BOARD_NAME "firefly"
#define CONFIG_E2000D_DEMO_BOARD
#define CONFIG_BOARD_NAME "demo"
/* IO mux configuration when board start up */
/* CONFIG_USE_SPI_IOPAD is not set */
/* CONFIG_USE_GPIO_IOPAD is not set */
/* CONFIG_USE_CAN_IOPAD is not set */
/* CONFIG_USE_QSPI_IOPAD is not set */
/* CONFIG_USE_PWM_IOPAD is not set */
/* CONFIG_USE_ADC_IOPAD is not set */
/* CONFIG_USE_MIO_IOPAD is not set */
/* CONFIG_USE_TACHO_IOPAD is not set */
/* CONFIG_USE_UART_IOPAD is not set */
/* CONFIG_USE_THIRD_PARTY_IOPAD is not set */
#define CONFIG_FIREFLY_DEMO_BOARD
/* IO mux configuration when board start up */
/* end of IO mux configuration when board start up */
/* CONFIG_CUS_DEMO_BOARD is not set */
@ -207,8 +214,12 @@
#define CONFIG_IMAGE_LOAD_ADDRESS 0x80100000
#define CONFIG_IMAGE_MAX_LENGTH 0x1000000
#define CONFIG_HEAP_SIZE 1
#define CONFIG_STACK_SIZE 0x400
#define CONFIG_FPU_STACK_SIZE 0x1000
#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 Build setup */

0
example/system/jtag_debugging/.aarch32_mode_change

11
example/system/jtag_debugging/README.md

@ -38,6 +38,9 @@
```makefile
OPENOCD_CMD := $(SDK_DIR)/tools/debugging/run_openocd_jlink.sh
#OPENOCD_CMD := $(SDK_DIR)/tools/debugging/run_openocd_dap.sh
OPENOCD_CMD := $(SDK_DIR)/tools/debugging/run_openocd_jlink.bat
#OPENOCD_CMD := $(SDK_DIR)/tools/debugging/run_openocd_dap.bat
```
![](./fig/board.jpeg)
@ -69,14 +72,6 @@ adaptor | TDO -- (6) (5)GND (6)TDO
下载安装SDK开发环境(Windows Msys2 或 Ubuntu 环境)
- Windows 下使用[env_msys64.exe](https://pan.baidu.com/s/1UIiYRHWjx15fHjj8nJX0Zw)
> 提取码: PHYT
- Ubuntu 和其他 Linux 使用[env_ubuntu_x64.tar.gz](https://pan.baidu.com/s/1UIiYRHWjx15fHjj8nJX0Zw)
> 提取码: PHYT
> 注意 WSL/WSL2 环境下使用 OpenOCD 调试需要额外配置 USB 设备驱动,具体可以[参考](https://blog.csdn.net/qq_41867145/article/details/126330935),推荐在 Windows 环境下直接使用 env_msys64.exe 解压包
使能例程所需的配置

9
example/system/jtag_debugging/makefile

@ -12,8 +12,13 @@ endif
USER_INCLUDE := $(PROJECT_DIR) \
$(PROJECT_DIR)/inc
OPENOCD_CMD := $(SDK_DIR)/tools/debugging/run_openocd_jlink.sh
# OPENOCD_CMD := $(SDK_DIR)/tools/debugging/run_openocd_dap.sh
ifeq ($(OS),Windows_NT)
# OPENOCD_CMD := $(SDK_DIR)/tools/debugging/run_openocd_jlink.bat
OPENOCD_CMD := $(SDK_DIR)/tools/debugging/run_openocd_dap.bat
else
# OPENOCD_CMD := $(SDK_DIR)/tools/debugging/run_openocd_jlink.sh
OPENOCD_CMD := $(SDK_DIR)/tools/debugging/run_openocd_dap.sh
endif
include $(SDK_DIR)/tools/build/makeall.mk

5
lib/libc/system_call.c

@ -498,4 +498,9 @@ int _gettimeofday(void)
void __sync_synchronize(void)
{
}
void _fini(void)
{
}

7
tools/build/menuconfig/preconfig.mk

@ -11,12 +11,19 @@ CONFIGS_OUTPUT_PATH ?= $(PROJECT_DIR)
.PHONY: load_kconfig
ifeq ($(OS),Windows_NT)
RED=
GREEN=
NC=
else
# 红色字体
RED=\033[0;31m
# 绿色字体
GREEN=\033[0;32m
# 重置字体颜色
NC=\033[0m
endif
#if sdkconfig not exits, prompt user to load default sdkconfig first

3
tools/debugging/run_openocd_dap.bat

@ -0,0 +1,3 @@
set OPENOCD_SCRIPTS_PATH=%PHYTIUM_OPENOCD_PATH%//share//openocd//scripts
%PHYTIUM_OPENOCD_PATH%//bin//openocd.exe -f %OPENOCD_SCRIPTS_PATH%//target//e2000d_cmsisdap_v1.cfg -s %OPENOCD_SCRIPTS_PATH%

13
tools/debugging/run_openocd_dap.sh

@ -1,12 +1,5 @@
#!/bin/sh
if [ "$(expr substr $(uname -s) 1 5)"=="Linux" ];then
sudo $PHYTIUM_OPENOCD_PATH/bin/openocd \
-f $PHYTIUM_OPENOCD_PATH/share/openocd/scripts/target/e2000d_cmsisdap_v1.cfg \
-s $PHYTIUM_OPENOCD_PATH/share/openocd/scripts
fi
if [ "$(expr substr $(uname -s) 1 7)"=="MSYS_NT" ];then
$PHYTIUM_OPENOCD_PATH/bin/openocd.exe \
-f $PHYTIUM_OPENOCD_PATH/scripts/target/e2000d_cmsisdap_v1.cfg \
-s $PHYTIUM_OPENOCD_PATH/scripts
fi
sudo $PHYTIUM_OPENOCD_PATH/bin/openocd \
-f $PHYTIUM_OPENOCD_PATH/share/openocd/scripts/target/e2000d_cmsisdap_v1.cfg \
-s $PHYTIUM_OPENOCD_PATH/share/openocd/scripts

3
tools/debugging/run_openocd_jlink.bat

@ -0,0 +1,3 @@
set OPENOCD_SCRIPTS_PATH=%PHYTIUM_OPENOCD_PATH%//share//openocd//scripts
%PHYTIUM_OPENOCD_PATH%//bin//openocd.exe -f %OPENOCD_SCRIPTS_PATH%//target//e2000d_jlink_v9.cfg -s %OPENOCD_SCRIPTS_PATH%

13
tools/debugging/run_openocd_jlink.sh

@ -1,12 +1,5 @@
#!/bin/sh
if [ "$(expr substr $(uname -s) 1 5)"=="Linux" ];then
sudo $PHYTIUM_OPENOCD_PATH/bin/openocd \
-f $PHYTIUM_OPENOCD_PATH/share/openocd/scripts/target/e2000d_jlink_v9.cfg \
-s $PHYTIUM_OPENOCD_PATH/share/openocd/scripts
fi
if [ "$(expr substr $(uname -s) 1 7)"=="MSYS_NT" ];then
$PHYTIUM_OPENOCD_PATH/bin/openocd.exe \
-f $PHYTIUM_OPENOCD_PATH/scripts/target/e2000d_jlink_v9.cfg \
-s $PHYTIUM_OPENOCD_PATH/scripts
fi
sudo $PHYTIUM_OPENOCD_PATH/bin/openocd \
-f $PHYTIUM_OPENOCD_PATH/share/openocd/scripts/target/e2000d_jlink_v9.cfg \
-s $PHYTIUM_OPENOCD_PATH/share/openocd/scripts
Loading…
Cancel
Save