[Fixed] 1.18.155 update breaks builds

RP2040 based microcontroller boards running MicroPython.
Target audience: MicroPython users with an RP2040 boards.
This does not include conventional Linux-based Raspberry Pi boards.
Post Reply
hippy
Posts: 130
Joined: Sat Feb 20, 2021 2:46 pm
Location: UK

[Fixed] 1.18.155 update breaks builds

Post by hippy » Thu Feb 24, 2022 3:18 pm

I am having a problem with building my cloned and tweaked port of the 'rp2' port since the recent update to 1.18.155; don't know whether that relates to the mpy-cross changes or something else. It built yesterday but now doesn't ...

Code: Select all

[ 74%] Building C object CMakeFiles/picopython.dir/frozen_content.c.obj
/home/pi/pico/micropython/ports/picopython/build/frozen_content.c:7661:16: error: multi-line comment [-Werror=comment]
     0x10,0x61, // LOAD_CONST_STRING \
Looking in 'build/frozen_content.c' -

Code: Select all

    0x10,0x60, // LOAD_CONST_STRING -=[]
    0x10,0x61, // LOAD_CONST_STRING \
    0xf2, // BINARY_OP 27 __add__
It seems that '\' is interpreted as a line continuation.

If I edit that out in 'build/frozen_content.c', I can run 'make' again and it all compiles okay, but a clean build puts it back in.

Presumably it's an issue with whatever creates 'build/frozen_content.c' ?
Last edited by hippy on Mon Feb 28, 2022 1:03 pm, edited 1 time in total.

hippy
Posts: 130
Joined: Sat Feb 20, 2021 2:46 pm
Location: UK

Re: 1.18.155 update breaks builds

Post by hippy » Thu Feb 24, 2022 3:59 pm

Seems the bug is in line ~867 of 'tools/mpy-tool.py' -

Code: Select all

print(
    "    %s, // %s" % (",".join("0x%02x" % b for b in bc[ip : ip + sz]), opcode_name)
)
My kludged fix ...

Code: Select all

print(
   "    %s, /* %s */" % (",".join("0x%02x" % b for b in bc[ip : ip + sz]), opcode_name)
)
Someone else will have to figure out what a better solution would be.

hippy
Posts: 130
Joined: Sat Feb 20, 2021 2:46 pm
Location: UK

Re: 1.18.155 update breaks builds

Post by hippy » Thu Feb 24, 2022 4:31 pm

And, for completeness, and perhaps useful for testing a fix - it seems the issue comes down to a self-created '.py' module placed in my './ports/picopython/modules' directory, which contains -

Code: Select all

  SetKeyCode(0x2D, "-=[]" + "\\" + "#;'`,./")
It's that "\\", which becomes "\" later on and when emitted, which leads to 'mpy-tool' breaking the build.

yjchun
Posts: 10
Joined: Fri Aug 27, 2021 8:04 pm

Re: 1.18.155 update breaks builds

Post by yjchun » Fri Feb 25, 2022 3:12 pm

Similar problem is on github issue now.
https://github.com/micropython/micropython/issues/8356

hippy
Posts: 130
Joined: Sat Feb 20, 2021 2:46 pm
Location: UK

Re: 1.18.155 update breaks builds

Post by hippy » Fri Feb 25, 2022 6:15 pm

Thanks to robert-hh and yourself for pursuing the issue. Unfortunately I'm in a position where it is not possible for me to file issues or contribute on GitHub. So the best I can do is report issues I encounter here along with any "what I have done" to fix things. That's not the best it could be but that's how it is.

BTW : %r is probably a better fix than mine because that probably fails on /* or */ or anything else GCC doesn't like embedded within comments. I was really only concerned about getting it to build at the time rather than fixing things.

hippy
Posts: 130
Joined: Sat Feb 20, 2021 2:46 pm
Location: UK

Re: [Fixed] 1.18.155 update breaks builds

Post by hippy » Mon Feb 28, 2022 1:04 pm

Thanks. All seems to have been fixed and it passed all tests I threw at it.

Post Reply