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

Add targets upstream for new ARM Cortex chips #88

Closed
jamesmunns opened this issue Apr 17, 2018 · 24 comments
Closed

Add targets upstream for new ARM Cortex chips #88

jamesmunns opened this issue Apr 17, 2018 · 24 comments

Comments

@jamesmunns
Copy link
Member

We should consider adding target JSONs and build rust-std compenents for the following targets before the 2018 era lands:

  • ARM Cortex-R Target(s) based on thumbv7em (Cortex-R4, R5, R7, R8)
  • ARM Cortex-M Target(s) based on thumbv8em (Cortex-M23 and Cortex-M33)
  • ARM Cortex-R Target(s) based on thumbv8em (Cortex-R52)

This may also require updates to low level crates like cortex-m, maybe compiler_builtins, though we should probably open separate issues for that.

We likely will need physical chips to verify functionality before adding them upstream, which may be difficult for chips based on thumbv8em, as they are not currently retailing at the moment (as far as I know, the Nordic nRF91 is the only one shipping, and it is only in a limited sample release).

@Lakier15
Copy link

Lakier15 commented May 3, 2018

I have been working on a R5F for an year and a half with Rust without any problem.

I want to start working on other targets of the Cortex-R family so that I can PR and add official support for them.

thumbv7em, thumbv8em are not the only targets we would need pursuing. Remember that the ARMv7 instruction set differs a lot between their subset ( ARMv7-A, ARMv7-R, ARMv7E-M, ARMv7-M );

In order to support what is now commercially available we would need (for what regards the Cortex-R architecture):

  • thumbv7r-none-eabi (Cortex-R4, R5, R7, R8)
  • thumbv7r-none-eabihf (Cortex-R4F, R5F, R7F, R8F)
  • thumbv7rbe-none-eabihf (Cortex-R5F Big Endian)
  • thumbv8r-none-eabi (Cortex-R52)
  • thumbv8r-none-eabihf (Cortex-R52F)

I have been working with the TMS570LC4357, which is probably the most unique R5F processor in the market, as it is the only one that has a R5F architecture and is big endian.

Cortex-R chips on the market

Cortex-R4

Texas Instruments: RM41Lx, RM42Lx, TMS570LS02x, TMS570LS03x, TMS570LS04x
Samsung: Artik 05x

Cortex-R4F

Texas Instruments: RM44Lx, RM46Lx, RM48Lx, TMS570LS07x, TMS570LS09x, TMS570LS11x, TMS570LS12x, TMS570LS21x, TMS570LS31x

Cortex-R5

Cypress: S6J31x

Cortex-R5F

Cypress: S6J32x, S6J33x, S6J34x, S6J35x

Cortex-R5F Big Endian

Texas Instruments: TMS570LC4357x, RM57Lx


I personally don't know about the R7(F), R8(F), R52(F). Maybe if anybody knows any better they can add to them to this list.

I have a R5F Big Endian (TMS570LC4357) and an R4 (Artik055s), so I could work to add support for those.

A word about the TMS570LC4357:
Because this is the only Big Endian processor I found pretty impossible to have a GCC prebuild toolchain to use as a linker.
My "hack" in this case is to compile everything as a library and link it in with the TI ARM CGT toolchain in order to produce a binary. This means that I cannot have a "pure" rust binary source code.
If the LLD linker can this job instead, that would be the perfect solution!

@paoloteti
Copy link

paoloteti commented May 14, 2018

Here https://github.com/paoloteti/ti-hercules-bsp you can find a board support package + JSON for TI TMS570LS3xx (tested on TMS570LS3137) that is a BigEndian Cortex-R4F (in LockStep mode).

Linaro toolchain (armeb-none-eabi) it is perfect and you don't need to use TI ARM CGT.

I already sent patches on compiler_builtins to add some missing features (mainly on VFP) , so it works as it is now!

Only the F021 flash memory need the TI F021 SDK because the algorithm is proprietary and the overall logic it is totally different form other flash memories. Mainly to ensure a set of safety constraints at silicon level. Here you can find a Rust binding.

I don't have time at the moment to add/integrate my work on upstream, but I can test on real hardware on my spare time.

BTW do not compare Cortex-R with Cortex-M: it is a different beast.

@paoloteti
Copy link

Cortex R4F/R5F (BE, ARM mode) is now upstream (PR 50813)

@jamesmunns
Copy link
Member Author

It seems like some of the thumbv8em chips are now shipping.

@japaric
Copy link
Member

japaric commented Aug 31, 2018

I was looking at the LLVM features for the ARMv8-M architecture and there are two ATM: v8m for baseline ARMv8-M (i.e. Cortex-M23) and v8m.main for mainline ARMv8-M (i.e. Cortex-M33). What I'm not sure about is how to call these new targets: thumbv8m-none-eabi for the M23, but then what would the M33 be called? thumbv8m.main-none-eabi? Furthermore the M33 has an optional FPU so we'll want two targets for that one: eabi and eabihf.

@paoloteti
Copy link

@japaric

What I'm not sure about is how to call these new targets: thumbv8m-none-eabi for the M23, but then what would the M33 be called? thumbv8m.main-none-eabi? Furthermore the M33 has an optional FPU so we'll want two targets for that one: eabi and eabihf.

Exactly, infact llc accept both thumbv8m.main-none-eabi and thumbv8m.base-none-eabi and with eabihf sets the VFP attribute (as minimum). (something like .eabi_attribute 28, 1 @ Tag_ABI_VFP_args).

@evq
Copy link

evq commented Oct 13, 2018

I opened a PR to add a target for baseline armv8-m rust-lang/rust#55041

@jamesmunns
Copy link
Member Author

Nice! Thanks @evq!

@thejpster
Copy link
Contributor

@evq is there any chance you might be able to share the test code you have for the SAM L11?

@evq
Copy link

evq commented Oct 29, 2018

@thejpster sure, I will upload later today. I have an svd2rust crate with LED example code for the SAM L11 as well as needed changes to the cortex-m, cortex-m-rt, cortex-m-semihosting, and panic-semihosting crates.

@thejpster
Copy link
Contributor

Awesome, thanks @evq !

@evq
Copy link

evq commented Nov 4, 2018

@thejpster You can find the svd2rust crate with example code here - https://github.com/evq/atsaml11xxx

@hug-dev
Copy link

hug-dev commented Nov 16, 2018

Armv8-M is trendy! I have been working with Rust and Armv8-M at Arm for the past few months and just made a pull-request for Mainline support rust-lang/rust#56000 !

@codido
Copy link

codido commented Mar 17, 2019

FWIW, the LPC55S69-EVK development board from NXP which has two Cortex-M33 cores is now shipping as well.

Things appear to work well including basic peripheral functionality, and only required a few mild modifications to the svd file.
The only minor gotcha was that cortex-m-rt includes the thumbv8m.base-none-eabi prebuilt library, but not thumbv8m.main-none-eabi.

By the way, it seems that out of the three thumbv8m targets, only thumbv8m.main-none-eabi is included in the manifests (and can be installed with rustup). Wasn't sure if that's intentional.

@hug-dev
Copy link

hug-dev commented Mar 17, 2019

@codido I think thumbv8m.main is currently being added to cortex-m-rt at rust-embedded/cortex-m-rt#167 and rust-embedded/cortex-m-rt#182

thumbv8m.mainhf and thumbv8m.base are currently being added to Rust CI (for rustup to pull) here: rust-lang/rust#59182 (as soon as I have more time)

@codido
Copy link

codido commented Mar 17, 2019

Thanks @hug-dev, missed those cortex-m-rt PRs, guess I don't need to push my version :)

@hug-dev
Copy link

hug-dev commented Apr 4, 2019

All the Armv8-M targets are now available with rustup in the latest nightly:

  • thumbv8m.base-none-eabi: Cortex-M23
  • thumbv8m.main-none-eabi: Cortex-M33
  • thumbv8m.main-none-eabihf: Cortex-M33 with FPU

@tarcieri
Copy link

Will thumbv8m.base-none-eabi land on stable soon? I was able to use it on nightly.

@thejpster
Copy link
Contributor

I assume it's riding the release train, and will turn up in two stable releases time?

@joelimgu
Copy link

Any news for the armv8-r for the R52?

@thejpster
Copy link
Contributor

It won't happen until someone both needs it and has the ability to do it and has the time or the funding to do it and has the appropriate hardware or simulator to run it on, sadly. Cortex-R is a bit specialist compared to Cortex-M.

@adamgreig
Copy link
Member

I believe these targets are all available now, including armv8r-none-eabihf.

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