im-tomu / foboot

Bootloader for Fomu
Apache License 2.0
100 stars 32 forks source link

tinyusb examples don't seem to work with current head of master (e928b868) #204

Open tcal-x opened 3 years ago

tcal-x commented 3 years ago

tinyusb/examples/device/cdc_dual_ports doesn't seem to work with the foboot updater that I build at current master head, e928b868f55030e75ac6ba274acf3ed34599ddb4.

The tinyusb examples work with the foboot 2.0.3 release. Also, I checked out c9571b5 and rebuild myself to make sure it wasn't something in my build environment. That worked with the tinyusb examples as well.

I'm filing this so I have a place to record my findings if I get time to do any bisection of the CLs.

xobs commented 3 years ago

Thanks for filing this.

Does it work if you set the csr width to 8? It was 8 in 2.0.3, but I believe it was adjusted upwards to 32. This would affect the timer register, which that example ought to use.

On 27 October 2020 5:08:18 am SGT, Other Tim notifications@github.com wrote:

tinyusb/examples/device/cdc_dual_ports doesn't seem to work with the foboot updater that I build at current master head, e928b868f55030e75ac6ba274acf3ed34599ddb4.

The tinyusb examples work with the foboot 2.0.3 release. Also, I checked out c9571b5 and rebuild myself to make sure it wasn't something in my build environment. That worked with the tinyusb examples as well.

I'm filing this so I have a place to record my findings if I get time to do any bisection of the CLs.

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/im-tomu/foboot/issues/204

tcal-x commented 3 years ago

Yep, that's it.

I changed to csr_data_width=8 in hw/foboot-bitstream.py, and also changed this line in sw/include/system.h:

 // Forward-define this function, because it's defined inside `csr.h`,
 // which includes this file near the top.
-static inline void reboot_ctrl_write(uint32_t v);
+static inline void reboot_ctrl_write(uint8_t v);

...which I was a little unsure about, but it compiled, and now the tinyusb examples work, with current master plus the changes above.

Now that you mention it, I do remember seeing some code that seemed a little funny in that it was relying on an implicit cast to 8b to truncate a value that was most probably outside of an 8b range originally. I can't remember exactly where I saw that code though.