Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(Examples,Tools): Upgrade RISC-V Toolchain, Update Project Files #628

Merged
merged 14 commits into from
Jun 22, 2023

Conversation

Jake-Carter
Copy link
Contributor

@Jake-Carter Jake-Carter commented Jun 16, 2023

This PR depends on #619 for its consolidated gcc.mk files.

Overview

  • Add support for xPack riscv-none-elf toolchain. (5188f32)
  • Use riscv-none-elf toolchain as default instead of the deprecated riscv-none-embed. (d678542)
  • Update project files to use riscv-none-elf version 12.2.0-3.1. (d678542, 92d8d1c)
    • The install location for the updated toolchain shall be Tools/xPack/riscv-none-elf-gcc/12.2.0-3.1
  • Add the new toolchain to the build tester
  • Update all project files

Project File Updates

For the most part, the changes are:

  • Use the new RISC-V toolchain
diff --git a/Examples/MAX78000/Hello_World/.vscode/settings.json b/Examples/MAX78000/Hello_World/.vscode/settings.json
index 3a6b363122..8e185bb9ce 100755
--- a/Examples/MAX78000/Hello_World/.vscode/settings.json
+++ b/Examples/MAX78000/Hello_World/.vscode/settings.json
@@ -28,11 +28,11 @@
     "RV_OCD_target_file":"${config:target}_riscv.cfg",
 
     "v_Arm_GCC":"10.3",
-    "v_xPack_GCC":"10.2.0-1.2",
+    "v_xPack_GCC":"12.2.0-3.1",
 
     "OCD_path":"${config:MAXIM_PATH}/Tools/OpenOCD",
     "ARM_GCC_path":"${config:MAXIM_PATH}/Tools/GNUTools/${config:v_Arm_GCC}",
-    "xPack_GCC_path":"${config:MAXIM_PATH}/Tools/xPack/riscv-none-embed-gcc/${config:v_xPack_GCC}",
+    "xPack_GCC_path":"${config:MAXIM_PATH}/Tools/xPack/riscv-none-elf-gcc/${config:v_xPack_GCC}",
     "Make_path":"${config:MAXIM_PATH}/Tools/MSYS2/usr/bin",
  • Remove duplicate entries in .vscode/settings.json (resolves MSDK-1201)
  • Include a file for detecting compiler-specific and build-specific compiler definitions (see comment) (53527bb, 35ab3df)
diff --git a/Examples/MAX32520/AES/.vscode/settings.json b/Examples/MAX32520/AES/.vscode/settings.json
index d0310e8209..df1171e0f7 100755
--- a/Examples/MAX32520/AES/.vscode/settings.json
+++ b/Examples/MAX32520/AES/.vscode/settings.json
@@ -71,6 +71,9 @@
         "TARGET=${config:target}",
         "TARGET_REV=0x4131",
         "__GNUC__"
+    ],
+    "C_Cpp.default.forcedInclude": [
+        "${workspaceFolder}/build/project_defines.h"
     ]
 }

MSDKGen has also been updated to check for projects that come preconfigured for non-default boards to match project settings when needed.

image

RISC-V -march Change

Commit: 5188f32

The upgrade to riscv-none-elf changed the default ISA spec. As recommended by this discussion post, the default -march option when using the new toolchain is now -march=rv32im_zicsr_zifencei. Note the new option does not use the compressed instruction set.

The old toolchain still defaults to -march=rv32imc.

-mabi has been kept at ilp32.

Our old gcc_riscv.mk file also seemed to be passing -march=rv32im to the compiler, but -march=rv32imafdc to the linker. It also did not give the -mabi option to the linker. I think this was a mistake but I'm not sure what the ramifications of the old behavior was. The new implementation passes the same -march and -mabi to the compiler, assembler, and linker stages.

@github-actions github-actions bot added BLE Related to Bluetooth Workflow Related to Workflow development labels Jun 16, 2023
@Jake-Carter Jake-Carter added Eclipse VS Code build system This issue or pull request is related to the MSDK build system Tools This issue or pull request involves a change to the Tools and removed BLE Related to Bluetooth labels Jun 16, 2023
@github-actions github-actions bot added BLE Related to Bluetooth and removed Tools This issue or pull request involves a change to the Tools labels Jun 16, 2023
@Jake-Carter Jake-Carter added Tools This issue or pull request involves a change to the Tools and removed BLE Related to Bluetooth labels Jun 20, 2023
Jake-Carter and others added 10 commits June 21, 2023 11:13
- This also adds the RISCV_PREFIX and ARM_PREFIX options to better avoid conflicts for multi-core projects
- Upgrade RISCV toolchain to riscv-none-elf v12.2.0-3.1
- Remove duplicate entries in settings.json arrays
- Match project settings to projects with non-default BSPs
Copy link
Contributor

@sihyung-maxim sihyung-maxim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know too much about the toolchain and project files, but looks good.

@Jake-Carter
Copy link
Contributor Author

Reverted mass project generation to make this PR more readable. The diff shouldn't crash your laptop anymore

"${config:board}",
"TARGET=${config:target}",
"TARGET_REV=0x4131",
"__GNUC__"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we have any code anymore that uses 'TARGET_REV'. We should probably start trying to phase it out.

@@ -44,7 +44,7 @@ all: build/$(PROJECT)-combined.elf
build/$(PROJECT)-combined.elf: build/$(PROJECT).elf buildrv/$(PROJECT).elf arm riscv
@arm-none-eabi-objcopy -I elf32-littlearm build/$(PROJECT).elf -O ihex build/$(PROJECT).hex
@cat build/$(PROJECT).hex | sed '/^:00000001FF/d' > build/$(PROJECT)a.hex
@riscv-none-embed-objcopy buildrv/$(RV_PROJECT).elf -O ihex buildrv/$(PROJECT).hex
@riscv-none-elf-objcopy buildrv/$(RV_PROJECT).elf -O ihex buildrv/$(PROJECT).hex
@cat build/$(PROJECT)a.hex buildrv/$(PROJECT).hex > build/$(PROJECT)-combined.hex
@arm-none-eabi-objcopy -I ihex build/$(PROJECT)-combined.hex -O elf32-littlearm build/$(PROJECT)-combined.elf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using $(ARM_PREFIX)-objcopy and $(RISCV_PREFIX)-objcopy.

Copy link
Contributor

@BobbyCounts BobbyCounts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good, I verified the added RISCV extensions are supported in the RTL

- Bump RISCV toolchain
- Use project_defines.h
@Jake-Carter Jake-Carter merged commit 295cae5 into analogdevicesinc:main Jun 22, 2023
@Jake-Carter Jake-Carter deleted the dev/riscv-elf branch June 22, 2023 22:54
@Jake-Carter Jake-Carter mentioned this pull request Jun 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build system This issue or pull request is related to the MSDK build system Eclipse Tools This issue or pull request involves a change to the Tools VS Code Workflow Related to Workflow development
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants