Skip to content

all: pretend to be linux/arm in baremetal targets #247

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 23, 2019

Conversation

aykevl
Copy link
Member

@aykevl aykevl commented Mar 22, 2019

So far, we've pretended to be js/wasm in baremetal targets to make the stdlib happy. Unfortunately, this has various problems because syscall/js (a dependency of many stdlib packages) thinks it can do JS calls, and emulating them gets quite hard with all changes to the syscall/js packages in Go 1.12.

This commit does a few things:

  • It lets baremetal targets pretend to be linux/arm instead of js/wasm.
  • It lets the loader only select particular packages from the src overlay, instead of inserting them just before GOROOT. This makes it possible to pick which packages to overlay for a given target. It also allows more fine-grained overlaying, like overlaying os or net without overlaying os/exec or net/http.
  • It adds a baremetal-only syscall package that stubs out almost all syscalls.

This should help with Go 1.12 support, see #211.

@aykevl aykevl force-pushed the baremetal-pretend-linuxarm branch from 7792670 to 114f3c2 Compare March 22, 2019 23:04
@aykevl aykevl changed the base branch from master to dev March 22, 2019 23:04
@aykevl
Copy link
Member Author

aykevl commented Mar 23, 2019

Tested examples/blinky1 and examples/echo on Arduino Uno and PCA10040.

@deadprogram
Copy link
Member

Tested a few examples from the drivers repo on the microbit and itsybitsy-m0. Looking good.

Did you happen to have a chance to try to build something for actual linux arm like on the raspberry pi?

So far, we've pretended to be js/wasm in baremetal targets to make the
stdlib happy. Unfortunately, this has various problems because
syscall/js (a dependency of many stdlib packages) thinks it can do JS
calls, and emulating them gets quite hard with all changes to the
syscall/js packages in Go 1.12.

This commit does a few things:
  * It lets baremetal targets pretend to be linux/arm instead of
    js/wasm.
  * It lets the loader only select particular packages from the src
    overlay, instead of inserting them just before GOROOT. This makes it
    possible to pick which packages to overlay for a given target.
  * It adds a baremetal-only syscall package that stubs out almost all
    syscalls.
@aykevl aykevl force-pushed the baremetal-pretend-linuxarm branch from 114f3c2 to 62cf491 Compare March 23, 2019 21:34
@aykevl
Copy link
Member Author

aykevl commented Mar 23, 2019

Rebased on top of dev.

Did you happen to have a chance to try to build something for actual linux arm like on the raspberry pi?

In theory that should have been tested with qemu in CircleCI, but just to be sure I built a few examples on my amd64 laptop, copied them over to my rpi3 and ran them there. They all worked perfectly.

@aykevl
Copy link
Member Author

aykevl commented Mar 23, 2019

Also note that I copied a few files over from the Go project, but as I left the copyright note in the header intact I think that should be fine.

@deadprogram
Copy link
Member

Merging.

@deadprogram deadprogram merged commit a2d0f79 into dev Mar 23, 2019
@deadprogram deadprogram deleted the baremetal-pretend-linuxarm branch March 23, 2019 21:58
This was referenced Mar 23, 2019
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.

2 participants