Skip to content
This repository was archived by the owner on Jan 30, 2024. It is now read-only.
This repository was archived by the owner on Jan 30, 2024. It is now read-only.

Cannot flash to XMC4500 #386

@KRACK-BIT

Description

@KRACK-BIT

Cannot run probe-run on an XMC4500 microcontroller; memory ranges are apparently incorrect
I am currently trying to flash a very basic hello world program as a proof-of-concept for running on my microcontroller; however, this fails to run.

To Reproduce
Steps to reproduce the behavior:

Example

  1. Install dependencies (snippet from my dockerfile):
RUN apt install -y libusb-1.0-0-dev libudev-dev
RUN apt install -y libudev-dev
RUN sudo apt install -y acl less man-db nano
RUN cargo install cargo-generate cargo-binutils
RUN cargo install cargo-flash probe-rs probe-rs-cli probe-run

RUN rustup target add thumbv7em-none-eabihf
RUN rustup component add llvm-tools-preview
RUN rustup component add rustfmt
  1. Write example/hello.rs
//! Prints "Hello, world!" on the host console using semihosting

#![no_main]
#![no_std]

use panic_semihosting as _;

use cortex_m_rt::entry;
use cortex_m_semihosting::hprintln;

#[entry]
fn main() -> ! {
    hprintln!("Hello, world!");

    // exit QEMU
    // NOTE do not run this on hardware; it can corrupt OpenOCD state
    // debug::exit(debug::EXIT_SUCCESS);

    loop {}
}
  1. Run it with cargo run --example hello

Expected and observed behavior
I was expecting it to successfully execute and print hello world

Resulting behavior however was

root@996f111a2f2d:/workspaces/kybe-rs# cargo run --example hello
    Finished dev [unoptimized + debuginfo] target(s) in 0.02s
     Running `probe-run --chip XMC4500-F100x1024 target/thumbv7em-none-eabihf/debug/examples/hello`
Error: Error while flashing

Caused by:
    No flash memory contains the entire requested memory range 0x0c000000.. 0xc000400.

config.toml

[target.'cfg(all(target_arch = "arm", target_os = "none"))']
runner = "probe-run --chip XMC4500-F100x1024"


rustflags = [
  # This is needed if your flash or ram addresses are not aligned to 0x10000 in memory.x
  # See https://github.com/rust-embedded/cortex-m-quickstart/pull/95
  "-C",
  "link-arg=--nmagic",

  # LLD (shipped with the Rust toolchain) is used as the default linker
  "-C",
  "link-arg=-Tlink.x",
]

[build]
target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU)

Probe details

The following devices were found:
[0]: J-Link (J-Link) (VID: 1366, PID: 0101, Serial: 000551022083, JLink)

Operating System:
Docker Desktop on Windows (i.e. Linux VM on Windows); I've got USB pass-through set up, am doing everything within Linux, and it was working without issue when flashing with GDB, so should be working indistinguishable to a Linux box.

ELF file (attachment)
I am happy to upload this, but rn GitHub isn't letting me upload things which are not a specific file type; what is the recommended way of uploading ELF files here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions