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

Error compiling on gnuc < 9, definition of alias uClibc. #57

Closed
wants to merge 56 commits into from

Conversation

moaxey
Copy link

@moaxey moaxey commented Aug 5, 2019

Similar to micropython#4457

shenki and others added 30 commits March 15, 2017 22:32
This port requires a lm32 cross compiler with libgcc enabled.

I built a GCC 6.2 toolchain with newlib by doing the following:

  $ ls
  binutils-2.27  gcc-6.2.0  mpc-1.0.2   newlib-2.4.0.20161025
  gmp-6.1.1  mpfr-3.1.5
  $ mkdir build
  $ cd build
  $ ../gcc-6.2.0/configure  --prefix=/opt/lm32 --enable-languages=c --target=lm32-elf
  $ make
  $ mkdir /opt/lm32 && chown $USER /opt/lm32
  $ make install

Then build a litex Qemu with the following:

  $ git clone https://github.com/shenki/qemu-litex
  $ cd qemu-litex
  $ ./configure --target-list=lm32-softmmu
  $ make

To build Micropython:

  $ cd micropython/lm32
  $ CROSS_COMPILE=/opt/lm32/bin/lm32-elf- make deploy

This produces an elf at lm32/build/firmware.elf. To run it:

  ./lm32-softmmu/qemu-system-lm32 -M litex -nographic -nodefaults \
   -serial stdio -kernel ~/dev/micropython/lm32/build/firmware.elf
   MicroPython v1.8.6-12-g674efbf5680a on 2016-11-20; litex with lm32
   Type "help()" for more information.
   >>>

To debug it:

  ./lm32-softmmu/qemu-system-lm32 -M litex -nographic -nodefaults \
   -serial stdio -kernel ~/dev/micropython/lm32/build/firmware.elf \
   -S -s -monitor pty
  char device redirected to /dev/pts/12 (label compat_monitor0)

This requires a lm32 GDB:

  $ conda/bin/lm32-elf-gdb build/firmware.elf -ex 'target remote localhost:1234'
  Reading symbols from build/firmware.elf...done.
  Remote debugging using localhost:1234
  0x40000000 in _start ()
  (gdb) c
  Continuing.

You can attach to the monitor to view the lm32 registers that are not
exposed by qemu:

  screen /dev/pts/12
  (qemu) QEMU 2.7.50 monitor - type 'help' for more information
  (qemu) info registers
  IN: PC=40000000
  ie=00000000 (IE=0 EIE=0 BIE=0) im=00000000 ip=00000000
  eba=00000000 deba=00000000

The port currently assumes you are running on the opsis-soc, targeted
for the minispartan6. You can adjust this by replacing the
include/generated directories with the ones from your litex soc in both
Qemu and Micropython.

Signed-off-by: Joel Stanley <[email protected]>
Updated to use mimasv2 using headers from HDMI2USB build at commit
cbd1e31b3a9f88e0d1ecb682b51f6d41454766de
We were hardcoding the memory regions in the micropython linker script
(lm32.ld). This way we pull in the correct definitions whenever we
update the generated files.

Signed-off-by: Joel Stanley <[email protected]>
This follows what other ports do here.

Signed-off-by: Joel Stanley <[email protected]>
Doesn't work.

Signed-off-by: Joel Stanley <[email protected]>
ctrl+c can now interrupt execution.

>>> while True:
...     pass
...
Traceback (most recent call last):
  File "<stdin>", in <module>
KeyboardInterrupt:
>>>

Signed-off-by: Joel Stanley <[email protected]>
Signed-off-by: Joel Stanley <[email protected]>
We don't have any, and this was breaking building. It can be added back
later when we need it.

Signed-off-by: Joel Stanley <[email protected]>
This does change some flags passed to the compiler, but for the most
part should not result in any functional change.

Signed-off-by: Joel Stanley <[email protected]>
Adds about 12k to the code size. Most ports MPZ over the LONGLONG
version, which was my criteria for picking it.

Signed-off-by: Joel Stanley <[email protected]>
This is the first module we've enabled. With these changes in place we
it should't be much effort to add modules.

Signed-off-by: Joel Stanley <[email protected]>
Doesn't do anything yet.

Signed-off-by: Joel Stanley <[email protected]>
Only change is the addition of the CAS module for allowing software
access to the push buttons and LEDs

Signed-off-by: Joel Stanley <[email protected]>
This lets micropython control the LEDs

>>> import litex
>>> led1 = litex.LED(1)
>>> led1
LED(1)
>>> led1.on()
>>> led1.off()
>>> led1.read()
False
>>> led1.on()
>>> led1.read()
False

Signed-off-by: Joel Stanley <[email protected]>
This should not be hardcoded.

Signed-off-by: Joel Stanley <[email protected]>
Generated from

 https://github.com/timvideos/HDMI2USB-litex-firmware
 cba56bb65db62a4ee25bb66f5858349f8b043b9b.

Signed-off-by: Joel Stanley <[email protected]>
This is needed for opsis.

Created issue to get cas enabled on opsis
timvideos/HDMI2USB-litex-firmware#344
Allow litex leds to build without cas
litex_led_read now returns the correct value based on the state of the
led.
ewenmcneill and others added 24 commits August 27, 2018 14:26
Update to MicroPython 1.9.4+ from MicroPython upstream
Support LiteX boards which run main program from flash, eg TinyFPGA BX.

See timvideos/litex-buildenv#67 for required build environment changes.
Files come from the following revision;
```
commit 537b0e9058e6a5b77f434f46f3a56849c82064bd
Merge: 9c6f76f1 5c83c881
Author: enjoy-digital <[email protected]>
Date:   Tue Sep 18 08:19:09 2018 +0200

    Merge pull request micropython#101 from cr1901/icestorm-migen-pull

    Icestorm Improvements
```
Include files from litex.
Added a switch object to the litex module based off the led object.
Fixed function header for cas_switches_in_read to match real definition.
Added switch support for mimasv2
@ewenmcneill
Copy link

Thanks for spotting the problem and finding a work around.

See also #56 (which I created, when I found this issue a week or so ago), which references the upstream patch for this (micropython@7bbde67).

I think it'd be better to:

  1. Fast forward our MicroPython to match upstream (see Build error with gcc 9.x.x #56 (comment) for hints from upstream on what else might need changing), which would pick up their patch for this issue; or

  2. Cherry Pick the upstream patch exactly, from micropython@7bbde67, so we'll at least have matching code and can skip that whole patch when catching up to upstream.

I'd rather not apply patches outside of ports/fupy which (a) won't be going upstream and (b) are known to conflict with patches which are upstream.

Ewen

PS: I have a feeling that we have the upstream .travis.yml, but none of the other Travis setup for it to work with cross compiles, etc. See, eg, #14

Copy link

@whatnick whatnick left a comment

Choose a reason for hiding this comment

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

Tested and worked for me to compilation

@ewenmcneill
Copy link

Tested and worked for me to compilation

@whatnick It works for me too (see #56, where I did basically the same thing). But for the reasons I stated in #57 (comment), I think it's an unfortunate idea to merge a patch which will conflict with upstream. It'd be much better to merge the actual upstream patch (micropython@7bbde67) literally (so it won't conflict later), or fast forward our micropython fork to match upstream (thus also picking up their patch).

Ewen

@mithro
Copy link
Member

mithro commented Aug 8, 2019

I have rebased our changes on top of micropython/micropython@master (3d02ebb), so this build error should no longer occur.

@mithro mithro closed this Aug 8, 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.

8 participants