Skip to content

Commit

Permalink
Action: add support for linux-arm64 platform (#48)
Browse files Browse the repository at this point in the history
* feat: add support for ARM64 architecture in distributionUrl() and install() functions

* fix: update ARM GNU toolchain download URL

* fix: update md5 checksum

* ci: update test.yml to conditionally execute commands based on runner arch. and matrix release

* fix: update md5 checksum
  • Loading branch information
leoli0605 authored Jul 13, 2024
1 parent 6a9aab5 commit 2bfc65c
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 7 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,26 +72,57 @@ jobs:
if: runner.os != 'Windows'
run: '! arm-none-eabi-gcc --version'
- name: Set up GCC Arm Compiler
if: |
(runner.arch == 'X86' || runner.arch == 'X64') ||
(runner.arch == 'ARM64' && !contains(matrix.release, '2013') && !contains(matrix.release, '2014')
&& !contains(matrix.release, '2015') && !contains(matrix.release, '2016')
&& !contains(matrix.release, '2017') && !contains(matrix.release, '2018')
&& (matrix.release != '8-2019-q3'))
uses: ./
with:
release: ${{ matrix.release }}
- name: Print out programs invoked by the compiler
if: |
(runner.arch == 'X86' || runner.arch == 'X64') ||
(runner.arch == 'ARM64' && !contains(matrix.release, '2013') && !contains(matrix.release, '2014')
&& !contains(matrix.release, '2015') && !contains(matrix.release, '2016')
&& !contains(matrix.release, '2017') && !contains(matrix.release, '2018')
&& (matrix.release != '8-2019-q3'))
run: arm-none-eabi-gcc -v
- name: Print out version
if: |
(runner.arch == 'X86' || runner.arch == 'X64') ||
(runner.arch == 'ARM64' && !contains(matrix.release, '2013') && !contains(matrix.release, '2014')
&& !contains(matrix.release, '2015') && !contains(matrix.release, '2016')
&& !contains(matrix.release, '2017') && !contains(matrix.release, '2018')
&& (matrix.release != '8-2019-q3'))
run: arm-none-eabi-gcc --version
- name: Check the version matches
if: |
(runner.arch == 'X86' || runner.arch == 'X64') &&
(!contains(matrix.release, '2013') && !contains(matrix.release, '2014')
&& !contains(matrix.release, '2015') && !contains(matrix.release, '2016')
&& (matrix.release != 'latest'))
run: arm-none-eabi-gcc --version | grep -qi ${{ matrix.release }}
- name: Clone STM32 project
if: |
(runner.arch == 'X86' || runner.arch == 'X64') ||
(runner.arch == 'ARM64' && !contains(matrix.release, '2013') && !contains(matrix.release, '2014')
&& !contains(matrix.release, '2015') && !contains(matrix.release, '2016')
&& !contains(matrix.release, '2017') && !contains(matrix.release, '2018')
&& (matrix.release != '8-2019-q3'))
uses: actions/checkout@v4
with:
repository: 'trebisky/stm32f103'
ref: 7cfe5feaf02c653352331374d2ad178eb04efde7
path: 'stm32f103/'
- name: Build simple blinky project
if: |
(runner.arch == 'X86' || runner.arch == 'X64') ||
(runner.arch == 'ARM64' && !contains(matrix.release, '2013') && !contains(matrix.release, '2014')
&& !contains(matrix.release, '2015') && !contains(matrix.release, '2016')
&& !contains(matrix.release, '2017') && !contains(matrix.release, '2018')
&& (matrix.release != '8-2019-q3'))
working-directory: ./stm32f103/blink1/
run: make all

Expand Down
12 changes: 8 additions & 4 deletions src/gcc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const versions: {[gccRelease: string]: {[platform: string]: UrlData}} = {
},
linux_aarch64: {
url:
'https://developer.arm.com/-/media/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1-aarch64-arm-none-eabi.tar.xz?rev=04bfc790b30b477fab2621438ab231a7&hash=DB6D39BABFBF369F5683118F96DA4711',
'https://developer.arm.com/-/media/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1-aarch64-arm-none-eabi.tar.xz',
md5: '2014a0ebaae3168da555efdcabf03f2a',
},
},
Expand Down Expand Up @@ -183,7 +183,7 @@ const versions: {[gccRelease: string]: {[platform: string]: UrlData}} = {
linux_aarch64: {
url:
'https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-aarch64-linux.tar.bz2',
md5: 'e588d21be5a0cc9caa60938d2422b058',
md5: '1c3b8944c026d50362eef1f01f329a8e',
},
},
'9-2020-q2': {
Expand Down Expand Up @@ -632,15 +632,19 @@ export function latestGccVersion(): string {
return Object.keys(versions)[0];
}

export function distributionUrl(version: string, platform: string): UrlData {
export function distributionUrl(version: string, platform: string, arch?: string): UrlData {
// Convert the node platform value to the versions URL keys
let osName = '';
switch (platform) {
case 'darwin':
osName = 'mac_x86_64';
break;
case 'linux':
osName = 'linux_x86_64';
if (arch === 'arm64') {
osName = 'linux_aarch64';
} else {
osName = 'linux_x86_64';
}
break;
case 'win32':
osName = 'win32';
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ async function run(): Promise<void> {
if (!release || release === 'latest') {
release = latestGccVersion();
}
const installPath = await setup.install(release, process.platform);
const installPath = await setup.install(release, process.platform, process.arch);
const gccPath = setup.findGcc(installPath);
if (!gccPath) {
throw new Error(`Could not find gcc executable in ${gccPath}`);
Expand Down
4 changes: 2 additions & 2 deletions src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import md5File from 'md5-file';

import * as gcc from './gcc';

export async function install(release: string, platform: string): Promise<string> {
export async function install(release: string, platform: string, arch?: string): Promise<string> {
const toolName = 'gcc-arm-none-eabi';

// Get the GCC release info
const distData = gcc.distributionUrl(release, platform);
const distData = gcc.distributionUrl(release, platform, arch);

// Convert the GCC version to Semver so that it can be used with the GH cache
const toolVersion = gcc.gccVersionToSemver(release);
Expand Down

0 comments on commit 2bfc65c

Please sign in to comment.