Skip to content
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

Nothing builds with Ubuntu 18.04 #13

Open
sowbug opened this issue Aug 5, 2018 · 4 comments
Open

Nothing builds with Ubuntu 18.04 #13

sowbug opened this issue Aug 5, 2018 · 4 comments

Comments

@sowbug
Copy link
Contributor

sowbug commented Aug 5, 2018

This isn't your fault, but you should know about it. Something broke in the gcc toolchain between Ubuntu 16.04 and 18.04, and many programs you build and try to flash to your Tomu will fail to load. The miniblink example works, but u2f and usb-audiostream don't. They all work if built with 16.04.

I think this was happening with GnuK as well.

I worked around this by starting up a Google Compute Engine instance with 16.04 and scping stuff back and forth. It scratched my itch, but it's pretty annoying.

I hope someone narrows down exactly what's wrong and files a good bug with whichever tool is broken. I haven't had time to compare generated object files, which is what I'd do to start with.

@xobs
Copy link
Member

xobs commented Aug 6, 2018

Thanks for reporting this.

It appears to be an issue with libopencm32. Specifically, the usbd_poll() function -- if you disable the USB ISR, it works just fine.

I'm without my debugger right now, so I'll see how much debugging I can do. It certainly feels like 18.04 got aggressive when it comes to packing, and maybe some struct got not-word-aligned.

@xobs
Copy link
Member

xobs commented Aug 21, 2018

Ubuntu 18.04 is completely broken.

Their memcpy() jumps to an address that doesn't exist:

xobs@Pazuzu:~/Code/Tomu/quickstart/usb-hid$ gdb-multiarch usb-hid.elf
GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from usb-hid.elf...done.
(gdb) disassemble memcpy,+4
Dump of assembler code from 0x5950 to 0x5954:
   0x00005950 <memcpy+0>:       movs    r7, r1
   0x00005952 <memcpy+2>:       b.n     0x5ffa
End of assembler dump.
(gdb) x 0x5ffa
0x5ffa: Cannot access memory at address 0x5ffa
(gdb)

You may need to try a different compiler.

@xobs
Copy link
Member

xobs commented Aug 21, 2018

Upstream bug: https://bugs.launchpad.net/ubuntu/+source/gcc-arm-none-eabi/+bug/1767223

The issue is that it's ignoring the -mcpu=cortex-m0plus and linking in the desktop version of libc, which contains ARM instructions. The Cortex M-series only supports Thumb2 instructions, so any time you call any standard library function the program will crash.

@xobs
Copy link
Member

xobs commented Aug 21, 2018

Workaround to fix the issue on Ubuntu 18.04 LTS (courtesy of @madhacker on #tomu): bbcmicrobit/micropython#514 (comment)

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

No branches or pull requests

2 participants