← index #7894Issue #9314
Related · high · value 0.637
QUERY · ISSUE

windows/mingw strange compiler error when freezing viper code

openby andrewleechopened 2021-10-12updated 2022-09-29

I was tring to freeze some libraries into a mingw windows build today, forgetting there was viper code in some of them.
There's an odd compiler error though that took me way too long to figure out was related to the viper functions, so thought it was worth documenting here:

micropython/ports/windows$ make CROSS_COMPILE=i686-w64-mingw32- FROZEN_MANIFEST=manifest.py
...
CC build/frozen_content.c
/tmp/ccm1KbYo.s: Assembler messages:
/tmp/ccm1KbYo.s:225: Warning: Ignoring changed section attributes for .text
/tmp/ccm1KbYo.s:225: Error: junk at end of line, first unrecognized character is `,'
/tmp/ccm1KbYo.s:270: Warning: Ignoring changed section attributes for .text
/tmp/ccm1KbYo.s:270: Error: junk at end of line, first unrecognized character is `,'

building from current master (d42cba0d22c) with

$ i686-w64-mingw32-gcc -v
Using built-in specs.
COLLECT_GCC=i686-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-w64-mingw32/9.3-win32/lto-wrapper
Target: i686-w64-mingw32
Configured with: ../../src/configure --build=x86_64-linux-gnu --prefix=/usr --includedir='/usr/include' --mandir='/usr/share/man' --infodir='/usr/share/info' --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libdir='/usr/lib/x86_64-linux-gnu' --libexecdir='/usr/lib/x86_64-linux-gnu' --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --enable-shared --enable-static --disable-multilib --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --libdir=/usr/lib --enable-libstdcxx-time=yes --with-tune=generic --with-headers=/usr/i686-w64-mingw32/include --enable-version-specific-runtime-libs --enable-fully-dynamic-string --enable-libgomp --enable-languages=c,c++,fortran,objc,obj-c++,ada --enable-lto --enable-threads=win32 --program-suffix=-win32 --program-prefix=i686-w64-mingw32- --target=i686-w64-mingw32 --with-as=/usr/bin/i686-w64-mingw32-as --with-ld=/usr/bin/i686-w64-mingw32-ld --enable-libatomic --enable-libstdcxx-filesystem-ts=yes --enable-dependency-tracking
Thread model: win32
gcc version 9.3-win32 20200320 (GCC)

details:

micropython/ports/windows$ cat manifest.py
freeze("../../tests/micropython")

micropython/ports/windows$ make CROSS_COMPILE=i686-w64-mingw32- FROZEN_MANIFEST=manifest.py CFLAGS_EXTRA='-save-temps'
...
frozen_content.s:6875: Error: junk at end of line, first unrecognized character is `,'
make: *** [../../py/mkrules.mk:77: build/build/frozen_content.o] Error 1
src/micropython/ports/windows$ awk 'NR==6872,NR==6878{print NR" "$0}' frozen_content.s
6872    .word   4086
6873    .word   -28951
6874    .word   1
6875    .section        .text,"ax",@progbits # ,"dr"
6876    .align 32
6877 _fun_data_native_const_intbig__lt_module_gt__f:
6878    .ascii "USATAUH\203\354"

I gather for actual viper support on windows we'll need a finished version of https://github.com/micropython/micropython/pull/4699 but this error looks like it'll need a fix similar to https://github.com/micropython/micropython/pull/2851 based on the issues that PR closed?

CANDIDATE · ISSUE

ESP32: Viper code can't be called from frozen bytecode module.

closedby DusKing1opened 2022-09-14updated 2022-09-14
bug

I've tried my best to search for related issues, but I really can't find any, so if anyone finds something similar to mine, please let me know and I'll check the relevant issue/PR firstly.

My problem is that I have a piece of viper code that works fine when imported as a user file (.py), but compiles if I freeze it to bytecode and include it in the compiled firmware, the firmware that comes out cannot call that piece of viper code normally, and it will give the following error warning:

Guru Meditation Error: Core  1 panic'ed (LoadStoreError). Exception was unhandled.

Core  1 register dump:
PC      : 0x401de5bc  PS      : 0x00060530  A0      : 0x800dbc7a  A1      : 0x3ffccc00
A2      : 0x3ffe5880  A3      : 0x00000001  A4      : 0x3ffea6f0  A5      : 0x3f410b0c
A6      : 0x3f419250  A7      : 0x3f41eb2c  A8      : 0x801de5b7  A9      : 0x3ffccbd0
A10     : 0x3f410b0c  A11     : 0x00000005  A12     : 0x000000c8  A13     : 0x3ffccd54
A14     : 0x00000000  A15     : 0x3ffe5794  SAR     : 0x00000004  EXCCAUSE: 0x00000003
EXCVADDR: 0x3f410b0c  LBEG    : 0x4000c46c  LEND    : 0x4000c477  LCOUNT  : 0x00000000

Backtrace:0x401de5b9:0x3ffccc00 0x400dbc77:0x3ffccc40 0x400e2641:0x3ffccc60 0x400e2771:0x3ffccc80 0x40084749:0x3ffccca0 0x400dbd2e:0x3ffccd40 0x400e2641:0x3ffccda0 0x400e2771:0x3ffccdc0 0x40084749:0x3ffccde0 0x400dbd2e:0x3ffcce80 0x400e2641:0x3ffcceb0 0x400e266a:0x3ffcced0 0x400ff33a:0x3ffccef0 0x400ff3ad:0x3ffccf80 0x400ff66c:0x3ffccfb0 0x400e27ec:0x3ffcd090 0x400849a9:0x3ffcd0d0 0x400dbd2e:0x3ffcd170 0x400e2641:0x3ffcd1c0 0x400e266a:0x3ffcd1e0 0x400efb92:0x3ffcd200 0x400eff39:0x3ffcd290 0x400d4cca:0x3ffcd2b0


ELF file SHA256: 001762e7fe9dfd58

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied