tinygo-org / tinygo

Go compiler for small places. Microcontrollers, WebAssembly (WASM/WASI), and command-line tools. Based on LLVM.
https://tinygo.org
Other
14.77k stars 865 forks source link

Teensy 4.1 support #1598

Open wbourne0 opened 3 years ago

wbourne0 commented 3 years ago

Is there any plans in place for supporting the teensy 4.1?

From what I can tell, it uses the same chip as the teensy 4.0, so I think a good bit of it can is done in #1425.

I'm happy to help with it, though I'm not sure what to do with most of it so I don't know if I'll be able to help much.

Thanks.

ardnew commented 3 years ago

Most of the Teensy 4.0 support can indeed be re-used for Teensy 4.1 - the entire runtime package in particular.

To add Teensy 4.1 support, a new board file src/machine/board_teensy41.go defining how pins are broken out on the PCB, target JSON targets/teensy41.json and linker script targets/mimxrt1062-teensy41.ld/targets/teesny41.s need to be added. You can probably re-use the Teensy 4.0 as template for most of this.

See the Wiki page for general concepts on what is required: https://github.com/tinygo-org/tinygo/wiki/Adding-a-new-board

wbourne0 commented 3 years ago

Oh yep, I've actually been doing a little bit of work on this. The main issue that i have is not knowing if i did things the correct way. I also can't get serial communication to work which is annoying.

wbourne0 commented 3 years ago

All i've been able to do is get it to turn a light on or off at the start, and i haven't been able to get any timing to work and as such can't tell if im able to turn a light on and off

ardnew commented 3 years ago

Oh yep, I've actually been doing a little bit of work on this. The main issue that i have is not knowing if i did things the correct way. I also can't get serial communication to work which is annoying.

@AllAwesome497 If you want to post a link to your branch I'd be happy to review

wbourne0 commented 3 years ago

@ardnew so a bit of an update: Here's what I've done:

Problem is, I can't seem to get anything working (no uart, no gpio). The only indication that its even being flashed is that it overrides the code that I flash with arduino.

uart also isn't working over usb, no /dev/ttyACM*. I also made an arduino program with my arduino that would read from the pins directly and echo over usb which worked w/ serial in arduino code but not w/ tinygo.

wbourne0 commented 3 years ago

I've got a branch of a fork with what I've done so far if you want to take a look: https://github.com/AllAwesome497/tinygo/tree/board-teensy41.