From 0543e52d593daefe98c80e45b4d97be50412cf78 Mon Sep 17 00:00:00 2001 From: IOsetting Date: Fri, 10 Feb 2023 23:07:54 +0800 Subject: [PATCH] chore: jlink 7.70 -> 7.84, update readme --- Makefile | 3 +- .../JLinkDevices/Puya/PY32/Devices.xml} | 28 ++-- .../Puya/PY32}/PY32F003xx_16.FLM | Bin .../Puya/PY32}/PY32F003xx_32.FLM | Bin .../Puya/PY32}/PY32F003xx_64.FLM | Bin .../Puya/PY32}/PY32F003xx_OPT.FLM | Bin .../Puya/PY32}/PY32F030xx_16.FLM | Bin .../Puya/PY32}/PY32F030xx_32.FLM | Bin .../Puya/PY32}/PY32F030xx_48.FLM | Bin .../Puya/PY32}/PY32F030xx_64.FLM | Bin .../Puya/PY32}/PY32F030xx_8.FLM | Bin .../Puya/PY32}/PY32F030xx_OPT.FLM | Bin .../Puya/PY32}/PY32F072xx_128.FLM | Bin .../Puya/PY32}/PY32F072xx_OPT.FLM | Bin .../Puya/PY32}/PY32F0xx_16.FLM | Bin .../Puya/PY32}/PY32F0xx_20.FLM | Bin .../Puya/PY32}/PY32F0xx_32.FLM | Bin .../Puya/PY32}/PY32F0xx_48.FLM | Bin .../Puya/PY32}/PY32F0xx_64.FLM | Bin .../Puya/PY32}/PY32F0xx_8.FLM | Bin .../Puya/PY32}/PY32F0xx_OPT.FLM | Bin README.md | 132 +++++++----------- 22 files changed, 66 insertions(+), 97 deletions(-) rename Misc/{JLinkDevices.xml => Flash/JLinkDevices/Puya/PY32/Devices.xml} (64%) rename Misc/Flash/{Devices/Puya => JLinkDevices/Puya/PY32}/PY32F003xx_16.FLM (100%) rename Misc/Flash/{Devices/Puya => JLinkDevices/Puya/PY32}/PY32F003xx_32.FLM (100%) rename Misc/Flash/{Devices/Puya => JLinkDevices/Puya/PY32}/PY32F003xx_64.FLM (100%) rename Misc/Flash/{Devices/Puya => JLinkDevices/Puya/PY32}/PY32F003xx_OPT.FLM (100%) rename Misc/Flash/{Devices/Puya => JLinkDevices/Puya/PY32}/PY32F030xx_16.FLM (100%) rename Misc/Flash/{Devices/Puya => JLinkDevices/Puya/PY32}/PY32F030xx_32.FLM (100%) rename Misc/Flash/{Devices/Puya => JLinkDevices/Puya/PY32}/PY32F030xx_48.FLM (100%) rename Misc/Flash/{Devices/Puya => JLinkDevices/Puya/PY32}/PY32F030xx_64.FLM (100%) rename Misc/Flash/{Devices/Puya => JLinkDevices/Puya/PY32}/PY32F030xx_8.FLM (100%) rename Misc/Flash/{Devices/Puya => JLinkDevices/Puya/PY32}/PY32F030xx_OPT.FLM (100%) rename Misc/Flash/{Devices/Puya => JLinkDevices/Puya/PY32}/PY32F072xx_128.FLM (100%) rename Misc/Flash/{Devices/Puya => JLinkDevices/Puya/PY32}/PY32F072xx_OPT.FLM (100%) rename Misc/Flash/{Devices/Puya => JLinkDevices/Puya/PY32}/PY32F0xx_16.FLM (100%) rename Misc/Flash/{Devices/Puya => JLinkDevices/Puya/PY32}/PY32F0xx_20.FLM (100%) rename Misc/Flash/{Devices/Puya => JLinkDevices/Puya/PY32}/PY32F0xx_32.FLM (100%) rename Misc/Flash/{Devices/Puya => JLinkDevices/Puya/PY32}/PY32F0xx_48.FLM (100%) rename Misc/Flash/{Devices/Puya => JLinkDevices/Puya/PY32}/PY32F0xx_64.FLM (100%) rename Misc/Flash/{Devices/Puya => JLinkDevices/Puya/PY32}/PY32F0xx_8.FLM (100%) rename Misc/Flash/{Devices/Puya => JLinkDevices/Puya/PY32}/PY32F0xx_OPT.FLM (100%) diff --git a/Makefile b/Makefile index 67ec7f0..5c24b12 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ BUILD_DIR = Build ##### Options ##### -# Use LL library instead of HAL +# Use LL library instead of HAL, y:yes, n:no USE_LL_LIB ?= n # Enable printf float %f support, y:yes, n:no ENABLE_PRINTF_FLOAT ?= n @@ -73,6 +73,7 @@ CDIRS += Libraries/PY32F0xx_LL_Driver/Src \ Libraries/BSP_LL/Src INCLUDES += Libraries/PY32F0xx_LL_Driver/Inc \ Libraries/BSP_LL/Inc +LIB_FLAGS += USE_FULL_LL_DRIVER else CDIRS += Libraries/PY32F0xx_HAL_Driver/Src \ Libraries/BSP/Src diff --git a/Misc/JLinkDevices.xml b/Misc/Flash/JLinkDevices/Puya/PY32/Devices.xml similarity index 64% rename from Misc/JLinkDevices.xml rename to Misc/Flash/JLinkDevices/Puya/PY32/Devices.xml index d869dc6..5ce1048 100644 --- a/Misc/JLinkDevices.xml +++ b/Misc/Flash/JLinkDevices/Puya/PY32/Devices.xml @@ -1,41 +1,41 @@ - - - - + + + + - + - + - + - + - + - + - + - + - + - + diff --git a/Misc/Flash/Devices/Puya/PY32F003xx_16.FLM b/Misc/Flash/JLinkDevices/Puya/PY32/PY32F003xx_16.FLM similarity index 100% rename from Misc/Flash/Devices/Puya/PY32F003xx_16.FLM rename to Misc/Flash/JLinkDevices/Puya/PY32/PY32F003xx_16.FLM diff --git a/Misc/Flash/Devices/Puya/PY32F003xx_32.FLM b/Misc/Flash/JLinkDevices/Puya/PY32/PY32F003xx_32.FLM similarity index 100% rename from Misc/Flash/Devices/Puya/PY32F003xx_32.FLM rename to Misc/Flash/JLinkDevices/Puya/PY32/PY32F003xx_32.FLM diff --git a/Misc/Flash/Devices/Puya/PY32F003xx_64.FLM b/Misc/Flash/JLinkDevices/Puya/PY32/PY32F003xx_64.FLM similarity index 100% rename from Misc/Flash/Devices/Puya/PY32F003xx_64.FLM rename to Misc/Flash/JLinkDevices/Puya/PY32/PY32F003xx_64.FLM diff --git a/Misc/Flash/Devices/Puya/PY32F003xx_OPT.FLM b/Misc/Flash/JLinkDevices/Puya/PY32/PY32F003xx_OPT.FLM similarity index 100% rename from Misc/Flash/Devices/Puya/PY32F003xx_OPT.FLM rename to Misc/Flash/JLinkDevices/Puya/PY32/PY32F003xx_OPT.FLM diff --git a/Misc/Flash/Devices/Puya/PY32F030xx_16.FLM b/Misc/Flash/JLinkDevices/Puya/PY32/PY32F030xx_16.FLM similarity index 100% rename from Misc/Flash/Devices/Puya/PY32F030xx_16.FLM rename to Misc/Flash/JLinkDevices/Puya/PY32/PY32F030xx_16.FLM diff --git a/Misc/Flash/Devices/Puya/PY32F030xx_32.FLM b/Misc/Flash/JLinkDevices/Puya/PY32/PY32F030xx_32.FLM similarity index 100% rename from Misc/Flash/Devices/Puya/PY32F030xx_32.FLM rename to Misc/Flash/JLinkDevices/Puya/PY32/PY32F030xx_32.FLM diff --git a/Misc/Flash/Devices/Puya/PY32F030xx_48.FLM b/Misc/Flash/JLinkDevices/Puya/PY32/PY32F030xx_48.FLM similarity index 100% rename from Misc/Flash/Devices/Puya/PY32F030xx_48.FLM rename to Misc/Flash/JLinkDevices/Puya/PY32/PY32F030xx_48.FLM diff --git a/Misc/Flash/Devices/Puya/PY32F030xx_64.FLM b/Misc/Flash/JLinkDevices/Puya/PY32/PY32F030xx_64.FLM similarity index 100% rename from Misc/Flash/Devices/Puya/PY32F030xx_64.FLM rename to Misc/Flash/JLinkDevices/Puya/PY32/PY32F030xx_64.FLM diff --git a/Misc/Flash/Devices/Puya/PY32F030xx_8.FLM b/Misc/Flash/JLinkDevices/Puya/PY32/PY32F030xx_8.FLM similarity index 100% rename from Misc/Flash/Devices/Puya/PY32F030xx_8.FLM rename to Misc/Flash/JLinkDevices/Puya/PY32/PY32F030xx_8.FLM diff --git a/Misc/Flash/Devices/Puya/PY32F030xx_OPT.FLM b/Misc/Flash/JLinkDevices/Puya/PY32/PY32F030xx_OPT.FLM similarity index 100% rename from Misc/Flash/Devices/Puya/PY32F030xx_OPT.FLM rename to Misc/Flash/JLinkDevices/Puya/PY32/PY32F030xx_OPT.FLM diff --git a/Misc/Flash/Devices/Puya/PY32F072xx_128.FLM b/Misc/Flash/JLinkDevices/Puya/PY32/PY32F072xx_128.FLM similarity index 100% rename from Misc/Flash/Devices/Puya/PY32F072xx_128.FLM rename to Misc/Flash/JLinkDevices/Puya/PY32/PY32F072xx_128.FLM diff --git a/Misc/Flash/Devices/Puya/PY32F072xx_OPT.FLM b/Misc/Flash/JLinkDevices/Puya/PY32/PY32F072xx_OPT.FLM similarity index 100% rename from Misc/Flash/Devices/Puya/PY32F072xx_OPT.FLM rename to Misc/Flash/JLinkDevices/Puya/PY32/PY32F072xx_OPT.FLM diff --git a/Misc/Flash/Devices/Puya/PY32F0xx_16.FLM b/Misc/Flash/JLinkDevices/Puya/PY32/PY32F0xx_16.FLM similarity index 100% rename from Misc/Flash/Devices/Puya/PY32F0xx_16.FLM rename to Misc/Flash/JLinkDevices/Puya/PY32/PY32F0xx_16.FLM diff --git a/Misc/Flash/Devices/Puya/PY32F0xx_20.FLM b/Misc/Flash/JLinkDevices/Puya/PY32/PY32F0xx_20.FLM similarity index 100% rename from Misc/Flash/Devices/Puya/PY32F0xx_20.FLM rename to Misc/Flash/JLinkDevices/Puya/PY32/PY32F0xx_20.FLM diff --git a/Misc/Flash/Devices/Puya/PY32F0xx_32.FLM b/Misc/Flash/JLinkDevices/Puya/PY32/PY32F0xx_32.FLM similarity index 100% rename from Misc/Flash/Devices/Puya/PY32F0xx_32.FLM rename to Misc/Flash/JLinkDevices/Puya/PY32/PY32F0xx_32.FLM diff --git a/Misc/Flash/Devices/Puya/PY32F0xx_48.FLM b/Misc/Flash/JLinkDevices/Puya/PY32/PY32F0xx_48.FLM similarity index 100% rename from Misc/Flash/Devices/Puya/PY32F0xx_48.FLM rename to Misc/Flash/JLinkDevices/Puya/PY32/PY32F0xx_48.FLM diff --git a/Misc/Flash/Devices/Puya/PY32F0xx_64.FLM b/Misc/Flash/JLinkDevices/Puya/PY32/PY32F0xx_64.FLM similarity index 100% rename from Misc/Flash/Devices/Puya/PY32F0xx_64.FLM rename to Misc/Flash/JLinkDevices/Puya/PY32/PY32F0xx_64.FLM diff --git a/Misc/Flash/Devices/Puya/PY32F0xx_8.FLM b/Misc/Flash/JLinkDevices/Puya/PY32/PY32F0xx_8.FLM similarity index 100% rename from Misc/Flash/Devices/Puya/PY32F0xx_8.FLM rename to Misc/Flash/JLinkDevices/Puya/PY32/PY32F0xx_8.FLM diff --git a/Misc/Flash/Devices/Puya/PY32F0xx_OPT.FLM b/Misc/Flash/JLinkDevices/Puya/PY32/PY32F0xx_OPT.FLM similarity index 100% rename from Misc/Flash/Devices/Puya/PY32F0xx_OPT.FLM rename to Misc/Flash/JLinkDevices/Puya/PY32/PY32F0xx_OPT.FLM diff --git a/README.md b/README.md index 42192e6..943044c 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ **Note** -There is high probability that PY32F002A, PY32F003 and PY32F030 share the same core, despite all the parts listed, you can simply treat them all as PY32F030 in coding and programming. +There is high probability that PY32F002A, PY32F003 and PY32F030 share the same core, despite all the parts listed, you can treat them all as PY32F030 in coding and programming. # File Structure @@ -41,8 +41,9 @@ There is high probability that PY32F002A, PY32F003 and PY32F030 share the same c ├── Makefile # Make config ├── Misc │   ├── Flash -│   │   ├── Devices # FLM files +│   │   ├── JLinkDevices # JLink flash loaders │   │   └── Sources # Flash algorithm source code +│   ├── Puya.PY32F0xx_DFP.x.pack # DFP pack file for PyOCD │   └── SVD # SVD files ├── README.md ├── rules.mk # Pre-defined rules include in Makefile @@ -77,66 +78,18 @@ Download and install JLink from [J-Link / J-Trace Downloads](https://www.segger. ```bash # installation command for .deb -sudo dpkg -i JLink_Linux_V770a_x86_64.deb +sudo dpkg -i JLink_Linux_V784f_x86_64.deb +# uncompression command for .tar.gz +sudo tar xvf JLink_Linux_V784f_x86_64.tgz -C [target folder] ``` The default installation directory is */opt/SEGGER* -Copy all .FLM files from [Project directory]/Misc/Flash/Devices/Puya to [JLink directory]/Devices/Puya - +Copy [Project directory]/Misc/Flash/JLinkDevices to [User home]/.config/SEGGER/JLinkDevices/ ```bash cd py32f0-template -sudo cp -r Misc/Flash/Devices/* /opt/SEGGER/JLink/Devices/ +cp -r Misc/Flash/JLinkDevices/ ~/.config/SEGGER/ ``` - -Edit JLinkDevices.xml - -```bash -sudo vi /opt/SEGGER/JLink/JLinkDevices.xml -``` -Add the following lines in `` section - -```xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -``` - +Read more: [https://wiki.segger.com/J-Link_Device_Support_Kit](https://wiki.segger.com/J-Link_Device_Support_Kit) ## 2. Option #2: Install PyOCD @@ -166,52 +119,67 @@ git clone https://github.com/IOsetting/py32f0-template.git ## 4. Edit Makefile Change the settings in Makefile -* make sure **ARM_TOOCHAIN** points to the correct path of arm-none-eabi-gcc -* If you use J-Link, **FLASH_PROGRM** can be jlink or pyocd -* If you use DAPLink, set **FLASH_PROGRM** to pyocd -* ST-LINK is not supported yet. ST-LINK works in Windows Keil5, but I failed to make it work in Ubuntu -* Puya provides two sets of library, HAL lib and LL lib, switch with **USE_LL_LIB** option -* **ENABLE_PRINTF_FLOAT** will add `-u _printf_float` to link options, which will significantly increase the binary size. +* **USE_LL_LIB** Puya provides two sets of library, HAL and LL, set `USE_LL_LIB ?= y` to use LL instead of HAL. +* **ENABLE_PRINTF_FLOAT** set it to `y` to `-u _printf_float` to link options. This will increase the binary size. +* **USE_FREERTOS** Set `USE_FREERTOS ?= y` will include FreeRTOS in compilation +* **USE_DSP** Include CMSIS DSP or not +* **FLASH_PROGRM** + * If you use J-Link, `FLASH_PROGRM` can be jlink or pyocd + * If you use DAPLink, set `FLASH_PROGRM ?= pyocd` + * ST-LINK is not supported yet. +* **ARM_TOOCHAIN** Make sure it points to the correct path of arm-none-eabi-gcc ```makefile ##### Project ##### -PROJECT ?= app +PROJECT ?= app # The path for generated files -BUILD_DIR = Build +BUILD_DIR = Build ##### Options ##### -# Use LL library instead of HAL -USE_LL_LIB ?= n +# Use LL library instead of HAL, y:yes, n:no +USE_LL_LIB ?= n # Enable printf float %f support, y:yes, n:no -ENABLE_PRINTF_FLOAT ?= n +ENABLE_PRINTF_FLOAT ?= n +# Build with FreeRTOS, y:yes, n:no +USE_FREERTOS ?= n # Build with CMSIS DSP functions, y:yes, n:no -USE_DSP ?= n +USE_DSP ?= n # Programmer, jlink or pyocd -FLASH_PROGRM ?= pyocd +FLASH_PROGRM ?= pyocd ##### Toolchains ####### - -ARM_TOOCHAIN ?= /opt/gcc-arm/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi/bin +ARM_TOOCHAIN ?= /opt/gcc-arm/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-eabi/bin # path to JLinkExe -JLINKEXE ?= /opt/SEGGER/JLink/JLinkExe -# JLink device type, options: PY32F003X4, PY32F003X6, PY32F003X8, PY32F030X6, PY32F030X7, PY32F030X8 -JLINK_DEVICE ?= PY32F003X8 -# path to PyOCD -PYOCD_EXE ?= pyocd -# PyOCD device type, options: py32f003x4, py32f003x6, py32f003x8, py32f030x3, py32f030x4, py32f030x6, py32f030x7, py32f030x8 -PYOCD_DEVICE ?= py32f003x8 +JLINKEXE ?= /opt/SEGGER/JLink/JLinkExe +# JLink device type, options: +# PY32F002AX5, PY32F002X5, +# PY32F003X4, PY32F003X6, PY32F003X8, +# PY32F030X4, PY32F030X6, PY32F030X7, PY32F030X8 +JLINK_DEVICE ?= PY32F030X6 +# path to PyOCD, +PYOCD_EXE ?= pyocd +# PyOCD device type, options: +# py32f002ax5, py32f002x5, +# py32f003x4, py32f003x6, py32f003x8, +# py32f030x3, py32f030x4, py32f030x6, py32f030x7, py32f030x8 +# py32f072xb +PYOCD_DEVICE ?= py32f030x8 ##### Paths ############ -# Link descript file: py32f003x6.ld, py32f003x8.ld, py32f030x6.ld, py32f030x8.ld -LDSCRIPT = Libraries/LDScripts/py32f003x8.ld -# Library build flags: PY32F030x3, PY32F030x4, PY32F030x6, PY32F030x7, PY32F030x8, PY32F003x4, PY32F003x6, PY32F003x8 -LIB_FLAGS = PY32F003x8 +# Link descript file: py32f002x5.ld, py32f003x6.ld, py32f003x8.ld, py32f030x6.ld, py32f030x8.ld +LDSCRIPT = Libraries/LDScripts/py32f030x8.ld +# Library build flags: +# PY32F002x5, PY32F002Ax5, +# PY32F003x4, PY32F003x6, PY32F003x8, +# PY32F030x3, PY32F030x4, PY32F030x6, PY32F030x7, PY32F030x8, +# PY32F072xB +LIB_FLAGS = PY32F030x6 ``` ## 5. Compiling And Flashing