[Particle_Xenon/NRF5X] build fails - tinyusb hal file missing

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
jrrodgers
Posts: 4
Joined: Sun Mar 22, 2020 4:04 am

[Particle_Xenon/NRF5X] build fails - tinyusb hal file missing

Post by jrrodgers » Sun Mar 22, 2020 4:08 am

Hi,

when attempting to build micropython for the Particle Xenon board, the build fails - no target for 'lib/tinyusb/src/portable/nordic/nrf5x/hal_nrf5x.c'. Seems the file no longer exists in tinyusb... safe to modify the makefile to remove the reference to it? I'm assuming the code now lives someplace else, but didn't spend any real time trying to figure that out...

Any thoughts?

thanks!

User avatar
jimmo
Posts: 1685
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: [Particle_Xenon/NRF5X] build fails - tinyusb hal file missing

Post by jimmo » Sun Mar 22, 2020 9:08 am

Were you previously able to build for NRF before a recent update to master?

I think this is likely to be due to a weird git quirk when submodules (e.g. tinyusb) change the path to their own submodules (e.g. tinyusb's nrf drivers).

So try doing

Code: Select all

git submodule deinit -f lib/tinyusb
rm -rf .git/modules/lib/tinyusb
git submodule update --init --recursive lib/tinyusb
(Sorry on phone so can't verify the exact commands but conceptually you get the idea -- you need to destroy git's cache of the outer submodule).

jrrodgers
Posts: 4
Joined: Sun Mar 22, 2020 4:04 am

Re: [Particle_Xenon/NRF5X] build fails - tinyusb hal file missing

Post by jrrodgers » Sun Mar 22, 2020 2:52 pm

Thanks, will give it a try. This was my first attempt at building micropython - so yesterday was an attempt at following the getting started instructions and then building for the Xenon. I found the missing define was removed from Tinyusb in August 2019. I restored it, but now the define for NRF_CLOCK in TinyUsb is having issues. I'll try to reinit and see how it goes...

jrrodgers
Posts: 4
Joined: Sun Mar 22, 2020 4:04 am

Re: [Particle_Xenon/NRF5X] build fails - tinyusb hal file missing

Post by jrrodgers » Sun Mar 22, 2020 3:04 pm

Hi,

attempted the git update - but no help there. The compile error is that https://github.com/micropython/micropyt ... criptors.c is referencing TUD_DESC_STR_HEADER, which was removed from TinyUsb in August 2019 on this commit - (https://github.com/hathach/tinyusb/comm ... c63d0ce65d).

Restoring those are easy enough, but then there are a number of errors about the NRF_CLOCK define (samples included below):

In file included from ../../lib/nrfx/mdk/nrf.h:93:0,
from ../../lib/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c:31:
../../lib/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c: In function 'hfclk_running':
../../lib/nrfx/mdk/nrf52840.h:2824:37: error: incompatible type for argument 1 of 'nrf_clock_hf_is_running'
#define NRF_CLOCK ((NRF_CLOCK_Type*) NRF_CLOCK_BASE)
^
../../lib/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c:575:34: note: in expansion of macro 'NRF_CLOCK'
return nrf_clock_hf_is_running(NRF_CLOCK, NRF_CLOCK_HFCLK_HIGH_ACCURACY);
^~~~~~~~~
In file included from ../../lib/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c:32:0:
../../lib/nrfx/hal/nrf_clock.h:462:22: note: expected 'nrf_clock_hfclk_t {aka enum <anonymous>}' but argument is of type 'NRF_CLOCK_Type * {aka struct <anonymous> *}'
__STATIC_INLINE bool nrf_clock_hf_is_running(nrf_clock_hfclk_t clk_src)
^~~~~~~~~~~~~~~~~~~~~~~
../../lib/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c:575:10: error: too many arguments to function 'nrf_clock_hf_is_running'
return nrf_clock_hf_is_running(NRF_CLOCK, NRF_CLOCK_HFCLK_HIGH_ACCURACY);
^~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../lib/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c:32:0:
../../lib/nrfx/hal/nrf_clock.h:462:22: note: declared here
__STATIC_INLINE bool nrf_clock_hf_is_running(nrf_clock_hfclk_t clk_src)

Not sure if I missed a setup step or if the Particle Xenon build just isn't working at the moment...

Any idea of where to go next? Or is there a tag that will build the Xenon?

Thanks!

User avatar
jimmo
Posts: 1685
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: [Particle_Xenon/NRF5X] build fails - tinyusb hal file missing

Post by jimmo » Mon Mar 23, 2020 12:21 pm

Hi,

I had a few minutes to check this today. I'm not quite sure how I missed this but yes, the TinyUSB update from PR #5558 did break this. I'm not sure how I missed that the NRF port used TinyUSB and needed to be updated (I updated the SAMD port only).

So in order to get your build working I'd probably just

git revert 6cea369b89b2223cf07ff8768e50dc39bbb770fe

and then re-update the tinyusb submodule.

I'll fix the NRF port to work with the new TinyUSB ASAP. You're right about hal_nrf5x.c (it was merged into the other file in the same dir), but I'll have to dig into the other changes.

Sorry about that!

(Edit: I'll also add at least one of the NRF USB boards to the CI build to avoid something like this happening again)

User avatar
jimmo
Posts: 1685
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: [Particle_Xenon/NRF5X] build fails - tinyusb hal file missing

Post by jimmo » Wed Mar 25, 2020 5:42 am

I have all the NRF boards building again but limited ability to test NRF here. I'll send the PR anyway, and follow up when I have a chance to do some testing (I have a Xenon also and some nRF51822 boards)

jrrodgers
Posts: 4
Joined: Sun Mar 22, 2020 4:04 am

Re: [Particle_Xenon/NRF5X] build fails - tinyusb hal file missing

Post by jrrodgers » Thu Mar 26, 2020 3:42 am

That's good news! Thanks for the info above - the revert worked, I was able to build. I'll start playing around with it on my Xenon to see how it goes. Thanks again for the help

Post Reply