tinyusb
tinyusb copied to clipboard
Fixes for building with IAR toolchain
I'm aiming to get TinyUSB to build with the IAR Embedded Workbench toolchain (I'm testing against Arm version 9.20.4) and specifically, I'm trying to build it as part of the Raspberry Pi Pico SDK. In doing so, I've identified a number of issues. Some of these are in rp2040-specific source files, but many others are in platform-neutral ones.
I've grouped the changes into a series of commits based upon the diagnostic generated by IAR. The first four are errors, and prevent the build from proceeding. The remainder are fixes for warnings (I'm more generally aiming to get the entire Pico SDK to build without warnings).
Thanks for your PR, most changes are good for me, especially explicit enum type conversion.
I don't use RP2040 so I can't test these changes. ~~I feel like most IAR users use traditional MCUs~~
@pigrew Could you take a look at changes in USBTMC class ?
actually this code
https://github.com/hathach/tinyusb/blob/f1a859d90701564dc6e152197454fae1f49ee846/src/portable/raspberrypi/rp2040/rp2040_usb.h#L39
is wrong (and likely won't actually compile on IAR)
It should read
#define usb_hw_set ((usb_hw_t *) hw_set_alias_untyped(usb_hw))
#define usb_hw_clear ((usb_hw_t *) hw_clear_alias_untyped(usb_hw))
(Note the hw_xxx_alias_untyped
vs hw_xxx_alias
)
@kilograham ah thanks, I haven't tried IAR with rp2040, will make PR per your suggestion. I saw rpi team is also doing IAR support within pico-sdk as well, nice timing.
indeed - that is no coincidence ;-) and yeah the change to this PR is a result of me making changes to what was merged there ;-)