Skip to content

machine: add generic board support on non-baremetal hardware - #426

Merged
deadprogram merged 1 commit into
devfrom
boardsimu2
Jun 28, 2019
Merged

machine: add generic board support on non-baremetal hardware#426
deadprogram merged 1 commit into
devfrom
boardsimu2

Conversation

@aykevl

@aykevl aykevl commented Jun 27, 2019

Copy link
Copy Markdown
Member

Instead of trying to modify periperhals directly, external functions are
called. For example, __tinygo_gpio_set sets a GPIO pin to a specified
value (high or low). It is expected that binaries made this way will be
linked with some extra libraries that implement support for these
functions.

One particularly interesting case is this experimental board simulator:
https://github.com/aykevl/tinygo-play
Compiling code to WebAssembly with the correct build tag for a board
will enable this board to be simulated in the browser.

Atmel/Microchip based SAMD boards are not currently supported, because
their I2C/SPI support is somewhat uncommon and harder to support in the
machine API. They may require a modification to the machine API for
proper support.

Instead of trying to modify periperhals directly, external functions are
called. For example, __tinygo_gpio_set sets a GPIO pin to a specified
value (high or low). It is expected that binaries made this way will be
linked with some extra libraries that implement support for these
functions.

One particularly interesting case is this experimental board simulator:
https://github.com/aykevl/tinygo-play
Compiling code to WebAssembly with the correct build tag for a board
will enable this board to be simulated in the browser.

Atmel/Microchip based SAMD boards are not currently supported, because
their I2C/SPI support is somewhat uncommon and harder to support in the
machine API. They may require a modification to the machine API for
proper support.
@deadprogram

Copy link
Copy Markdown
Member

Extremely exciting progress. Merging...

@deadprogram
deadprogram merged commit 4ecd478 into dev Jun 28, 2019
Comment thread Makefile
tinygo build -size short -o test.elf -target=pca10040 examples/test
# test all targets/boards
tinygo build -o test.elf examples/blinky2 # TODO: re-enable -size flag with MachO support
tinygo build -o test.wasm -tags=pca10040 examples/blinky2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to be -tags instead of -target? It's the odd-one out now.

Also, there's no longer a smoketest of no-target no-tags build (which I guess is native?)

@QuLogic QuLogic Jul 14, 2019

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS, I ask because the old smoketest used to fail on other arches, but if there's no expectation of compiling natively, then I won't continue investigating the missing support, as it won't be needed by the next release.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, 0.7.0 is out now and this smoketest is still gone, but regular go test still fails on other arches, so I guess I still need to investigate them.

@aykevl aykevl Sep 26, 2019

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I think I missed this comment. I'm pretty sure I added this test with -tags to test for board simulation, see https://play.tinygo.org/. The regular -target=pca10040 is already tested above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants