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

Pico riscv32? #706

Open
peardox opened this issue Sep 19, 2024 · 15 comments
Open

Pico riscv32? #706

peardox opened this issue Sep 19, 2024 · 15 comments

Comments

@peardox
Copy link

peardox commented Sep 19, 2024

Just installed by using the Pico button on the main app

After everything installed I switched to the cross tab and saw arm/embedded was pre-selected

Trying to select risc32/embedded should theoretically allow compilation for the Pico2 but this option resulted in 'no valid CPU target for embedded'

If you check out the specifications section here you will note that the Pico2 is dual architecture with m33 + risc32 (so there is a valid target)

@LongDirtyAnimAlf
Copy link
Owner

I have added this target.
Please test.
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/tag/v2.4.0fp

@peardox
Copy link
Author

peardox commented Sep 24, 2024

Tested (with issues)

My first attempt is to simply try updating my already installed pico-cross version

pico-riscv
Not a deal-breaker (yet) so hit OK + see what happens

pico-riscv-2
Rats - definitely a problem

OK, now let's try a fresh install in a new directory just in case something was supposed to be added to the old install
After OK, add arm/embedded (not sure if this was already done by Pico - it's not noted or anything)
Right - arm/embedded went OK, lets try riscv32/embedded again

Failure - as above images

Log file (only includes risvv-32 for some reason)
riscv.log

Ahh - there's another longer log in install dir - have that too just in case (but the above is prob the issue)
fpcup.log

@LongDirtyAnimAlf
Copy link
Owner

Well. The log-file tells you all you need. This line:

Makefile:1076: *** No CPUs enabled for given SUBARCH, pass either a SUBARCH or set CPU_UNITS_DEFINED=1 if you know what you are doing. Stop.

When compiling for embedded, you need to define a subarch.
So, define a subarch through the subarch button on the cross-tab. The button can be found below the compiler (install/remove-) buttons.
My advice would be to use the risrv32 imac subarch.

@peardox
Copy link
Author

peardox commented Sep 24, 2024

Well that worked but I'm not overly sure about using something labelled imac on a Windows host

There are, of course, native versions of all GCC stuff

Shouldn't it be somthing more akin to riscv32-none-elf or possibly riscv32-unknown-elf (the latter is used by the C toolchain for pico2 riscv)

The riscv toolchains used by Pico2 for the VSCode plugin are as follows currently

[RISCV_RPI_2_0_0_2]
win32_x64 = https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.0.0-2/riscv-toolchain-14-x64-win.zip
darwin_arm64 = https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.0.0-2/riscv-toolchain-14-arm64-mac.zip
darwin_x64 = https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.0.0-2/riscv-toolchain-14-x64-mac.zip
linux_x64 = https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.0.0-2/riscv-toolchain-14-x86_64-lin.tar.gz
linux_arm64 = https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.0.0-2/riscv-toolchain-14-aarch64-lin.tar.gz

@LongDirtyAnimAlf
Copy link
Owner

Well that worked but I'm not overly sure about using something labelled imac on a Windows host

?

The riscv toolchains used by Pico2 for the VSCode plugin are as follows currently

I just build my own toolchain, binutils only.
But I will have a look at these, especially for Mac.
Thanks !

@peardox
Copy link
Author

peardox commented Sep 24, 2024

This will probably be useful then

https://github.com/Wren6991/Hazard3

@LongDirtyAnimAlf
Copy link
Owner

Please explain why this is (only) valid for Windows ?

@peardox
Copy link
Author

peardox commented Sep 24, 2024

It'll build on anything

Not tried Mac (although I do have a very old one) but definitely works on Windows + Linux x64 and I've see it running on a Pi as well

My main interest was Win but also want to try Linux (+Mac + Pi eventually)

That specific compiler is more bleeding-edge than the stock ones mentiooned above

@ccrause
Copy link
Contributor

ccrause commented Sep 24, 2024

Well that worked but I'm not overly sure about using something labelled imac on a Windows host

The imac refers to instruction sets supported by the risc-v target: i = integer, m = multiply/divide, a = atomic, c = compressed (16 bit instruction length).

@peardox
Copy link
Author

peardox commented Sep 24, 2024

Ahh, that makes sense

Note that the Hazard3 doesn't have float (handled by a library AFAIK)

@LongDirtyAnimAlf
Copy link
Owner

:-) now I understand !!

@LongDirtyAnimAlf
Copy link
Owner

I have uploaded new pre release binaries of fpcupdeluxe. They will now download/use the raspberry binary tools. Please test.
(to do so, please remove the directory that contains the tools: "riscv32-embedded")
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/tag/v2.4.0fp

@peardox
Copy link
Author

peardox commented Sep 24, 2024

It's also worth mentioning that ...

The Pico(1?) had no FP either but also had an optmised FP library
The Pico2 has m33 as it's main CPU WITH floating point while the riscv Hazard3 is FP via library (optimisation coming)

At some point (when everything is OK) it may be worth while adding risc to the Pico btn (or having a pico 2 btn). Pico2 is a vast improvement over Pico so likely to be more popular (once in good supply)

Did complete install
Subarch still needs selecting but I note that tools are now riscv32-unknown-elf (dunno what they were before)

And - Success

@ccrause
Copy link
Contributor

ccrause commented Sep 24, 2024

Note that the Hazard3 doesn't have float (handled by a library AFAIK)

FPC doesn't yet support hardware floating point math on risc-v. For interest floating point functionality is indicated by: f - 32 bit single, d - 64 bit double, q - 128 bit quad precision.

@peardox
Copy link
Author

peardox commented Sep 24, 2024

People will be queueing up for the fimac :)

It's also got hardware SHA-256 and ARM Trust Zone - not that I imagine there are any codes...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants