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

How to use this package #7

Closed
hatimbt opened this issue Mar 20, 2021 · 7 comments
Closed

How to use this package #7

hatimbt opened this issue Mar 20, 2021 · 7 comments

Comments

@hatimbt
Copy link
Contributor

hatimbt commented Mar 20, 2021

I'm trying to get Rust booting on iMXRT106x chips and I'm finding it difficult to get it to boot properly.

My current setup includes imxrt-rt, imxrt-ral, and imxrt-hal.

I have some code running on the iMXRT1062, but I dont think the QSPI flash configuration is setup up. Usually I expect to see the QSPI flash configs at 0x60000000, and the IVT at 0x60001000. I do have the IVT visible, but the configs are not.

I've been trying to get these for a few days, and I would really appreciate any help. I was wondering if someone could share a project with minimal stuff thats needed to properly boot and setup the flash.

[dependencies.imxrt-boot-gen]
version = "0.2.0"
features = ["imxrt1060"]
@mciantyre
Copy link
Member

The examples in the imxrt-ral project might be a minimal starting point. There's an example that runs on a Teensy 4 (iMXRT1062). Although there's a Teensy 4 BSP, this example does not use the BSP.

  • QSPI flash config is provided by the teensy4-fcb crate. That crate uses this boot gen crate, and exposes the config as FLEXSPI_CONFIGURATION_BLOCK. See the linker script to confirm that it's at 0x60000000.
  • IVT is defined in the linker script, along with the rest of the boot data. IVT is offset from start of flash by 4K (absolute address 0x60001000).
  • The example uses the cortex-m-rt crate, rather than imxrt-rt. It's XIP, not taking advantage of any TCM regions.

These examples don't use imxrt-hal. But, once you get your system booting with a runtime crate and the RAL, including the HAL is straightforward.

I do have the IVT visible, but the configs are not.

Does this mean you're seeing the IVT in the output binary, but not the config? If the linker is stripping the config, make sure that you have a dummy use or extern crate directive somewhere in your library / binary. See the teensy4-fcb docs for more info, and here for the critical line in the imxrt-ral example. Remove that line, and the example fails to boot.

@hatimbt
Copy link
Contributor Author

hatimbt commented Mar 20, 2021

Hi

Thank you so much for your help. Managed to get it booting :)

Just a quick question. I got the imxrt_hal working on both the IMXRT1060EVK(with an MIMXRT1062 device) and the IMXRT1064EVK boards. Checking the documentation for the imxrt_hal, it does not mention that it supports the MIMXRT1064 device.

I had to change the BOOT and FLASH addresses in the memory.x file to 0x70000000 and 0x70001400 respectively.

My main work is going to be on the IMXRT1064 device with the built-in flash. Is there any potential issues with the imxrt_hal working on the IMXRT1064 (apart from basic booting)?

I'm new to Rust embedded, but I think once I get a bit of experience I wish to contribute back to the project.

HT

@mciantyre
Copy link
Member

mciantyre commented Mar 21, 2021

Thanks for working through this!

As long as you're not changing FlexSPI2 pin muxing configurations, the unpublished imxrt1060-hal will work on the 1064. Note that the 1060 HAL is using the imxrt1062 imxrt-ral API, which might seem questionable. But, it'll work for early prototyping.

If you'd like a release of the published, 0.4 imxrt-hal that supports the 1064, open an issue in the HAL project. This commit shows that we should be able to build the published HAL with 1064 support.

The HAL is still figuring out the simplest way to support all of the iMXRT MCUs. Our current thinking is to define an imxrt1064-hal crate, and have one HAL per reference manual. These are all just ideas, and we'd love your feedback and ideas in the HAL's issue tracker.

I had to change the BOOT and FLASH addresses in the memory.x file to 0x70000000 and 0x70001400 respectively.

I'm curious as to how to interface that on-board flash. I can't easily find any NXP docs that say "on-board flash starts at this address." (Since the 1064 RM notes that all FlexSPI2 pin muxing registers are "reserved," I'm guessing that on-board flash is available via FlexSPI2.)

@hatimbt
Copy link
Contributor Author

hatimbt commented Mar 21, 2021

I've continued the discussion here

@hatimbt hatimbt closed this as completed Mar 21, 2021
@teburd
Copy link
Member

teburd commented Mar 31, 2021

@hatimbt since you were able to use it with the evk boards, I'd really be interested in bringing updated board support packages under the org if you are interested in helping to create and maintain them.

@hatimbt
Copy link
Contributor Author

hatimbt commented Apr 21, 2021

@BFrog Hi I missed the notification for this and apologies. Yeah I'm more than willing to help. Are you talking about this imxrt-rs/imxrt1060evk-bsp? When I tried to use these, they did not build and I hadn't looked further into it.

@teburd
Copy link
Member

teburd commented Apr 21, 2021

Indeed the evk board support crate is pretty far behind the ral and hal at the moment, I need to spend a weekend or two at some point updating them. Really though the 1064 has its own evk and should have a similar board crate like the teensy4-rs crate.

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

No branches or pull requests

3 participants