The interrupt vectors are reported as missing for the nRF9160

I'm beginning a new project to target nRF9160 devices and the linker is stating that interrupt vectors are missing. I'm confused because I'm linking to a svd2rust dependent HAL (nrf9160-hal), I think the device feature should be therefore enabled for cortex-m-rt, and I don't think I should need to supply the interrupt handlers.

Here are my dependency declarations so far:

cortex-m = "0.6.0"
cortex-m-rt = "0.6.10"
cortex-m-semihosting = "0.3.3"
nrf9160-hal = "0.12.1"
panic-halt = "0.2.0"

Thanks for any guidance.

If you don't get an answer here, you can post on issue in the nrf9160-hal repository. They will surely be able to help you.

1 Like

I think the problem might be that you haven't enabled runtime support for the HAL. Replace this

nrf9160-hal = "0.12.1"

with this

nrf9160-hal = { version = "0.12.1", features = ["rt"] }

Or (which is the style that I prefer) move the dependency further down and write it like that:

version = "0.12.1"
features = ["rt"]

But that's just a difference in syntax.

1 Like

Thanks. I will try that again, but I’m pretty sure that the “rt” feature is the default.

That “device specific” syntax is also nicer so I’ll use that too.

The "rt" feature makes no difference - as stated, I think this is the default anyhow.

Further info, if I provide an explicit target with my build command i.e.

cargo build --target thumbv7em-none-eabi

...then all is well. This is interesting... I have the following in my .cargo/config file:

rustflags = [
  "-C", "linker=arm-none-eabi-gcc",
  "-C", "link-arg=-Wl,-Tlink.x",
  "-C", "link-arg=-nostartfiles",
  "-C", "link-arg=-mcpu=cortex-m33",

target = "thumbv7m-none-eabi"

... thus my default build target should be fine, right? I should therefore be able to just:

cargo build

But that doesn't work. I've also performed a rustup update to ensure that my toolchain is up to date. Thanks for any further advice.

For the record, this issue was at first confusing. However, I now find myself wanting to build for a specific target and run tests using std, so less of a problem for me. It'd still be interesting to learn why the default build target does not appear to work though.

Oh, you're right. Sorry, I didn't realize it was the default!

As you say, your issue is very confusing. The configuration in your .cargo/config should take care of it. Very weird.

Wait, I just spotted something. The target in your config file is thumbv7m-none-eabi. The target you pass on the command-line is thumbv7em-none-eabi (notice the additional e). Not sure if that's the relevant difference here, but it's something to try.

Also, isn't this an ARMv8-M device? According to nrf-rs/nrf9160-dk, thumbv8m.main-none-eabihf might be the correct target.


Good catch on both counts. I shall report back. Thanks!

You were indeed correct on both counts. Thanks so much for your help. I've marked your response as the solution.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.