Skip to content

Commit

Permalink
Add initial macOS support
Browse files Browse the repository at this point in the history
  • Loading branch information
KenjutsuGH committed May 7, 2024
1 parent e4686b8 commit 64269c4
Show file tree
Hide file tree
Showing 9 changed files with 139 additions and 9 deletions.
69 changes: 65 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,68 @@
# ArduinoCore-AT32F4
## Using this core with the Arduino IDE
## Introduction

To compile for this core with the Arduino IDE, add the following URL to the boards manager.
This repository is a fork of the original work by [WeActStudio](https://github.com/WeActStudio/ArduinoCore-AT32F4).

`https://raw.githubusercontent.com/WeActStudio/ArduinoCore-AT32F4/main/package_at32_index.json`
![image](https://user-images.githubusercontent.com/57818792/180649925-ed366423-5f76-42d5-b801-dd5ed2923825.png)
The purpose of this fork is to extend support for compiling and uploading Arduino code to WeAct AT32F4-based boards. It's important to note that this fork does not aim to introduce improvements or fixes to the original work by WeActStudio.

### Changes for macOS M1

This fork includes the following changes specifically for macOS M1:

- Addition of the ARM64 version of the GCC compiler (`xpack-arm-none-eabi-gcc-11.2.1-1.2-darwin-arm64`).
- Inclusion of the Artery OpenOCD port, which provides versions for Windows, Linux, and macOS.
- Addition of a shell script for the Artery ISP Console upload method. This script prints a message indicating that this upload method is currently not available for macOS.

### Supported Upload Methods

Currently, the following upload method is supported:

- OpenOCD via a DAPLink adapter.
- OpenOCD via a ST-Link adapter

For testing purposes, the [WeActStudio Mini Debugger](https://github.com/WeActStudio/WeActStudio.MiniDebugger) (ST-Link STM32F103CBT6 and DAPLink APM32F103CBT6) was used.

### Adding the Core to Arduino

To add the core to Arduino, follow these steps:

1. Add the following URL to the Arduino Boards Manager:

`https://raw.githubusercontent.com/KenjutsuGH/ArduinoCore-AT32F4/main/package_at32_index.json`

2. Proceed to **Tools** -> **Boards Manager** in the Arduino IDE and search for **AT32**.

<img src="images/BoardsManagerAT32.png" alt="Boards Manager" width="70%" height="70%">

3. After the installation is complete, you'll be able to select the WeActStudio board.

<img src="images/BoardSelected.png" alt="Select Board" width="70%" height="70%">

## Uploading to the WeActStudio board

For the purpose of this demonstration, navigate to **Files** -> **Examples** -> **01.Basics** -> **Blink**. Under the **Tools** menu, the following upload methods are available:

<img src="images/UploadMethods.png" alt="Select Board" width="70%" height="70%">

- The default option, **Artery DFU ISP**, is currently not supported on macOS and will produce the following error when attempting to upload to the board:

<img src="images/DFU.png" alt="Artery DFU ISP" width="70%" height="70%">

- The next option is **Artery OpenOCD DAPLink**. Ensure that the DAPLink adapter is correctly connected to the AT32F4 board before proceeding with the upload. Now the upload should proceed as expected:

<img src="images/OpenOCD.png" alt="Artery OpenOCD DAPLink" width="70%" height="70%">

- The next option is **Artery OpenOCD ST-Link**. Ensure that the ST-Link adapter is correctly connected to the AT32F4 board before proceeding with the upload. Now the upload should proceed as expected:

<img src="images/OpenOCD.png" alt="Artery OpenOCD DAPLink" width="70%" height="70%">


## Disclaimer

The code and information provided in this repository are for educational and informational purposes only. While efforts have been made to ensure the accuracy and reliability of the content, no warranty, express or implied, is provided regarding the completeness, accuracy, reliability, suitability, or availability of the code or information contained herein.

Usage of the code and information from this repository is at your own risk. The author(s) and contributors of this repository shall not be liable for any loss, damage, or injury arising from the use of or reliance on the code or information provided, including but not limited to direct, indirect, incidental, consequential, or punitive damages.

Furthermore, the code and information provided in this repository may be subject to change without notice. The author(s) and contributors reserve the right to modify, update, or remove any content from this repository at their discretion.

By accessing and using the code and information from this repository, you agree to indemnify and hold harmless the author(s) and contributors from any claims, damages, losses, liabilities, costs, and expenses arising from or related to your use of or reliance on the code or information provided herein.
12 changes: 11 additions & 1 deletion boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,14 @@ WeActStudioAT32F4.menu.pll_output_range.pll_output_range_le72mhz.build.f_pll_out
WeActStudioAT32F4.menu.upload_method.USBDFUMethod=Artery DFU ISP
WeActStudioAT32F4.menu.upload_method.USBDFUMethod.upload.protocol=Artery_ISP
WeActStudioAT32F4.menu.upload_method.USBDFUMethod.upload.tool=Artery_ISP_Console
WeActStudioAT32F4.menu.upload_method.USBDFUMethod.upload.maximum_size=1048576
WeActStudioAT32F4.menu.upload_method.USBDFUMethod.upload.maximum_size=1048576

WeActStudioAT32F4.menu.upload_method.OpenOCDDAPLink=Artery OpenOCD DAPLink
WeActStudioAT32F4.menu.upload_method.OpenOCDDAPLink.upload.protocol=cmsis-dap-v2
WeActStudioAT32F4.menu.upload_method.OpenOCDDAPLink.upload.tool=ArteryOpenOCD
WeActStudioAT32F4.menu.upload_method.OpenOCDDAPLink.upload.maximum_size=1048576

WeActStudioAT32F4.menu.upload_method.OpenOCDSTLink=Artery OpenOCD ST-Link
WeActStudioAT32F4.menu.upload_method.OpenOCDSTLink.upload.protocol=stlink
WeActStudioAT32F4.menu.upload_method.OpenOCDSTLink.upload.tool=ArteryOpenOCD
WeActStudioAT32F4.menu.upload_method.OpenOCDSTLink.upload.maximum_size=1048576
Binary file added images/BoardSelected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/BoardsManagerAT32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/DFU.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/OpenOCD.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/UploadMethods.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
53 changes: 49 additions & 4 deletions package_at32_index.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
"name": "WeActStudio",
"maintainer": "WeActStudio",
"email": "",
"websiteURL": "https://github.com/WeActStudio/ArduinoCore-AT32F4/",
"websiteURL": "https://github.com/KenjutsuGH/ArduinoCore-AT32F4/",
"help": {
"online": "https://github.com/WeActStudio/ArduinoCore-AT32F4/"
"online": "https://github.com/KenjutsuGH/ArduinoCore-AT32F4/"
},
"platforms": [
{
"name": "AT32F403ACGU7 Core Board",
"architecture": "at32f403a",
"version": "0.0.9",
"category": "Contributed",
"url": "https://github.com/WeActStudio/ArduinoCore-AT32F4/archive/refs/heads/main.zip",
"url": "https://github.com/KenjutsuGH/ArduinoCore-AT32F4/archive/refs/tags/v0.0.9.zip",
"archiveFileName": "ArduinoCore-AT32F4-main.zip",
"help": {
"online": ""
Expand All @@ -34,6 +34,11 @@
"packager": "WeActStudio",
"name": "Artery_ISP_Console",
"version": "0.0.1"
},
{
"packager": "WeActStudio",
"name": "ArteryOpenOCD",
"version": "0.1100.220911"
}
]
}
Expand All @@ -56,8 +61,14 @@
"archiveFileName": "xpack-arm-none-eabi-gcc-11.2.1-1.2-linux-x64.tar.gz",
"checksum": "SHA-256:7479becc1ea98fbceecadf1f036ddaba8dc39c9cce5cb45f0a7a36e923d33c9a",
"size": "235243515"
},
{
"host": "x86_64-apple-darwin",
"url": "https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/download/v11.2.1-1.2/xpack-arm-none-eabi-gcc-11.2.1-1.2-darwin-arm64.tar.gz",
"archiveFileName": "xpack-arm-none-eabi-gcc-11.2.1-1.2-darwin-arm64.tar.gz",
"checksum": "SHA-256:85afae936d84b5ed94ad15300d2333d4b0af34b53bbf92283e558a96209d0dd7",
"size": "231851100"
}

]
},
{
Expand All @@ -77,8 +88,42 @@
"archiveFileName": "Artery_ISP_Console_Linux_V3.0.01.tar.bz2",
"size": "14810873",
"checksum": "SHA-256:f84a0a2156a6b4bb8e8ccbc6d9b297517a526dfc857c4789176a906c91c26f77"
},
{
"host": "x86_64-apple-darwin",
"url": "https://raw.githubusercontent.com/KenjutsuGH/ArteryOpenOCD_Arduino_Tools/main/tools/Artery_ISP_Console_MacOS_Unavail.tar.bz2",
"archiveFileName": "Artery_ISP_Console_MacOS_Unavail.tar.bz2",
"size": "398",
"checksum": "SHA-256:84e48941ec8cc17617662e5d0cb5864e8064b4d6f81a847e3918834f17180448"
}
]
},
{
"name": "ArteryOpenOCD",
"version": "0.1100.220911",
"systems": [
{
"host": "i686-mingw32",
"url": "https://raw.githubusercontent.com/KenjutsuGH/ArteryOpenOCD_Arduino_Tools/main/tools/tool-openocd-at32-0.1100.220911.tar.gz",
"archiveFileName": "tool-openocd-at32-0.1100.220911.tar.gz",
"size": "5816791",
"checksum": "SHA-256:21ab0c36b9b43412a91ff972dde63c1cd7faf5d80ef81d0d2c7384256fa4ad17"
},
{
"host": "x86_64-pc-linux-gnu",
"url": "https://raw.githubusercontent.com/KenjutsuGH/ArteryOpenOCD_Arduino_Tools/main/tools/tool-openocd-at32-0.1100.220911.tar.gz",
"archiveFileName": "tool-openocd-at32-0.1100.220911.tar.gz",
"size": "5816791",
"checksum": "SHA-256:21ab0c36b9b43412a91ff972dde63c1cd7faf5d80ef81d0d2c7384256fa4ad17"
},
{
"host": "x86_64-apple-darwin",
"url": "https://raw.githubusercontent.com/KenjutsuGH/ArteryOpenOCD_Arduino_Tools/main/tools/tool-openocd-at32-0.1100.220911.tar.gz",
"archiveFileName": "tool-openocd-at32-0.1100.220911.tar.gz",
"size": "5816791",
"checksum": "SHA-256:21ab0c36b9b43412a91ff972dde63c1cd7faf5d80ef81d0d2c7384256fa4ad17"
}
]
}
]
}
Expand Down
14 changes: 14 additions & 0 deletions platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,17 @@ tools.Artery_ISP_Console.path={runtime.tools.Artery_ISP_Console.path}
tools.Artery_ISP_Console.upload.params.verbose=-d
tools.Artery_ISP_Console.upload.params.quiet=
tools.Artery_ISP_Console.upload.pattern="{path}/{cmd}" "{build.path}/{build.project_name}.hex"

#
# OpenOCD DAP-Link / ST-Link
#

tools.ArteryOpenOCD.cmd=openocd
tools.ArteryOpenOCD.cmd.macosx=bin-darwin_x86_64/openocd
tools.ArteryOpenOCD.cmd.linux=bin-linux_x86_64/openocd
tools.ArteryOpenOCD.cmd.windows=bin-windows_amd64/openocd.exe
tools.ArteryOpenOCD.path={runtime.tools.ArteryOpenOCD.path}

tools.ArteryOpenOCD.upload.params.verbose=-d
tools.ArteryOpenOCD.upload.params.quiet=
tools.ArteryOpenOCD.upload.pattern="{path}/{cmd}" -s {path}/scripts -f {path}/scripts/interface/{upload.protocol}.cfg -f {path}/scripts/target/at32f403axx.cfg -c init -c "program {build.path}/{build.project_name}.hex verify reset exit"

0 comments on commit 64269c4

Please sign in to comment.