LongDirtyAnimAlf / fpcupdeluxe

A GUI based installer for FPC and Lazarus
487 stars 89 forks source link

Pico riscv32? #706

Open peardox opened 1 week ago

peardox commented 1 week ago

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 commented 5 days ago

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

peardox commented 5 days ago

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 commented 5 days ago

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 commented 5 days ago

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 commented 5 days ago

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 commented 5 days ago

This will probably be useful then

https://github.com/Wren6991/Hazard3

LongDirtyAnimAlf commented 5 days ago

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

peardox commented 5 days ago

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 commented 5 days ago

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 commented 5 days ago

Ahh, that makes sense

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

LongDirtyAnimAlf commented 5 days ago

:-) now I understand !!

LongDirtyAnimAlf commented 5 days ago

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 commented 5 days ago

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 commented 5 days ago

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 commented 5 days ago

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...