problem with esp-idf 4.0 and assembler

wevets
Posts: 112
Joined: Sat Mar 09, 2019 2:56 am

problem with esp-idf 4.0 and assembler

Postby wevets » Fri Apr 17, 2020 1:53 am

I am in the process of converting a program to esp-idf 4.0. I have installed 4.0 according to the vanilla instructions.
While assembling a .S file with the following lines:

Code: Untitled.asm Select all


54     // Data segment
55 .bss
56 .global LastReadHi // Last reported read hi word
In which I declare a pile of assembler variables,
And then the first few lines of the .text segment

Code: Untitled.asm Select all


110     // Code segment
111 .text
112 .global entry
113 entry:
immediately followed, with an intervening comment, by

Code: Untitled.asm Select all

124 // First count and report the number of times ULP has cycled
125 move r3, ULPcycles
126 ld r0, r3, 0
127 add r0, r0, 1
128 st r0, r3, 0
I get the following errors out of the assembler as invoked with a simple “idf.py build” command:

Code: Untitled.txt Select all

P.S.obj.d -o esp-idf/ulp/CMakeFiles/__idf_ulp.dir/PartBinULP.S.obj -c ../components/ulp/PartBinULP.S
../components/ulp/PartBinULP.S: Assembler messages:
../components/ulp/PartBinULP.S:55: Error: unknown pseudo-op: `.bss'
../components/ulp/PartBinULP.S:125: Error: unknown opcode or format name 'move'
../components/ulp/PartBinULP.S:126: Error: unknown opcode or format name 'ld'
../components/ulp/PartBinULP.S:127: Error: bad register name: r0
../components/ulp/PartBinULP.S:127: Error: junk at end of line, first unrecognized character is `r'
../components/ulp/PartBinULP.S:127: Internal error in ignore_rest_of_line at /builds/idf/crosstool-NG/.build/HOST-i686-w64-mingw32/xtensa-esp32-elf/src/binutils/gas/read.c:3762.
Please report this bug.
It looks to me like the assembler is barfing over perfectly normal directives and mnemonics, which used to work with esp-idf 3.3 without error.

I’m seeing other problems as well as I migrate to 4.0, but I’d first like to resolve this.
Thanks.

semisdot
Posts: 1
Joined: Wed Feb 18, 2026 3:40 pm

Re: problem with esp-idf 4.0 and assembler

Postby semisdot » Wed Feb 18, 2026 4:06 pm

I got similar errors from the assembler. This is how I resolved it:

[*] .pio/libdeps/esp32dev/ulptool-pio/src/esp32ulp_build_recipe.py

Code: Select all

sdk_hash = md5(os.path.join(PATHS['core'] , 'tools', 'sdk', 'esp32', 'include', 'config', 'sdkconfig.h'))
Put in 'esp32' how it is above.

[*] .pio/libdeps/esp32dev/ulptool-pio/post_extra_script_ulptool.py

Code: Select all

toolchain_xtensa_dir = platform.get_package_dir("toolchain-xtensa-esp32")
Change it to "toolchain-xtensa-esp32" how it is above.


[*] This is my platformio.ini that I took from a ulp counter example, which could be another factor to the fix:

Code: Select all

[env]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200

lib_deps =
  https://github.com/likeablob/ulptool-pio#pio/0.1.0

extra_scripts =
  pre:/$PROJECT_LIBDEPS_DIR/$PIOENV/ulptool-pio/pre_extra_script_ulptool.py
  post:/$PROJECT_LIBDEPS_DIR/$PIOENV/ulptool-pio/post_extra_script_ulptool.py

[env:esp32dev]
board = esp32dev

Hope it helps!

Who is online

Users browsing this forum: Applebot and 4 guests