diff --git a/.github/workflows/run_tests.yaml b/.github/workflows/run_tests.yaml index 078f262..ab8d4bd 100644 --- a/.github/workflows/run_tests.yaml +++ b/.github/workflows/run_tests.yaml @@ -40,25 +40,32 @@ jobs: test $(micropython -c 'print("test")') = "test" popd - - name: Build binutils-esp32ulp - id: build_binutils + - name: Fetch binutils-esp32ulp + id: fetch_binutils run: | - echo "Building binutils-esp32ulp" - # building requires an older version of gcc - sudo apt-get install -y gcc-7 g++-7 - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 7 - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 7 - git clone --depth 1 https://github.com/espressif/binutils-esp32ulp.git - pushd binutils-esp32ulp - git describe --always --tags - ./configure --target=esp32ulp-elf --prefix=$PWD/dist --disable-doc --disable-gdb --disable-libdecnumber --disable-readline --disable-sim - echo "MAKEINFO = :" >> Makefile - make - make install-strip - export PATH=$PATH:$PWD/dist/bin - echo "bin_dir=$PWD/dist/bin" >> $GITHUB_OUTPUT + echo "Fetching URL of pre-built esp32ulp-elf binaries" + ## URL to pre-built binaries is published in esp-idf + IDFVER=v5.0.1 + curl -s \ + -o tools.json \ + https://raw.githubusercontent.com/espressif/esp-idf/$IDFVER/tools/tools.json + URL=$(> $GITHUB_OUTPUT esp32ulp-elf-as --version | grep 'esp32ulp-elf' > /dev/null - popd ###### Run tests ###### @@ -73,7 +80,7 @@ jobs: id: compat_tests run: | export PATH=$PATH:${{ steps.build_micropython.outputs.bin_dir }} - export PATH=$PATH:${{ steps.build_binutils.outputs.bin_dir }} + export PATH=$PATH:${{ steps.fetch_binutils.outputs.bin_dir }} cd tests ./01_compat_tests.sh @@ -81,7 +88,6 @@ jobs: id: compat_rtc_tests run: | export PATH=$PATH:${{ steps.build_micropython.outputs.bin_dir }} - export PATH=$PATH:${{ steps.build_binutils.outputs.bin_dir }} + export PATH=$PATH:${{ steps.fetch_binutils.outputs.bin_dir }} cd tests - ln -s ../binutils-esp32ulp # already cloned earlier. reuse. ./02_compat_rtc_tests.sh diff --git a/README.rst b/README.rst index 3413481..5ffa906 100644 --- a/README.rst +++ b/README.rst @@ -18,9 +18,10 @@ It can translate small assembly language programs to a loadable/executable ULP machine code binary, directly on the ESP32 microcontroller. This is intended as an alternative approach to assembling such programs using -the binutils-esp32ulp toolchain from Espressif on a development machine. +the `binutils-gdb toolchain `_ +(esp32-elf-as) from Espressif on a development machine. -It can also be useful in cases where binutils-esp32ulp is not available. +It can also be useful in cases where esp32-elf-as is not available. Features diff --git a/docs/index.rst b/docs/index.rst index 401bdc5..82712ec 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -151,7 +151,8 @@ Testing ------- There are unit tests and also compatibility tests that check whether the binary -output is identical with what binutils-esp32ulp produces. +output is identical with what Espressif's esp32-elf-as (from their `binutils-gdb fork +`_) produces. micropython-esp32-ulp has been tested on the Unix port of MicroPython and on real ESP32 devices with the chip type ESP32D0WDQ6 (revision 1) without SPIRAM. diff --git a/tests/01_compat_tests.sh b/tests/01_compat_tests.sh index 7aabe3c..4beb2b1 100755 --- a/tests/01_compat_tests.sh +++ b/tests/01_compat_tests.sh @@ -26,7 +26,7 @@ for src_file in $(ls -1 compat/*.S); do echo -e "\tBuilding using binutils" gcc -E -o ${pre_file} $src_file - esp32ulp-elf-as -o $obj_file ${pre_file} + esp32ulp-elf-as --mcpu=esp32 -o $obj_file ${pre_file} esp32ulp-elf-ld -T esp32.ulp.ld -o $elf_file $obj_file esp32ulp-elf-objcopy -O binary $elf_file $bin_file diff --git a/tests/02_compat_rtc_tests.sh b/tests/02_compat_rtc_tests.sh index de89aaf..1cfbe7c 100755 --- a/tests/02_compat_rtc_tests.sh +++ b/tests/02_compat_rtc_tests.sh @@ -27,12 +27,13 @@ fetch_ulptool_examples() { } fetch_binutils_esp32ulp_examples() { - [ -d binutils-esp32ulp ] && return + [ -d binutils-gdb ] && return - echo "Fetching binutils-esp32ulp examples" + echo "Fetching binutils-gdb (esp32ulp) examples" log_file=log/fetch-binutils.log git clone --depth 1 \ - https://github.com/espressif/binutils-esp32ulp.git 1>$log_file 2>&1 + -b esp32ulp-elf-v2.35_20220830 \ + https://github.com/espressif/binutils-gdb.git 1>$log_file 2>&1 } build_defines_db() { @@ -63,7 +64,7 @@ patch_test() { if [ "${test_name}" = esp32ulp_jumpr ]; then ( - cd binutils-esp32ulp/gas/testsuite/gas/esp32ulp/esp32 + cd binutils-gdb/gas/testsuite/gas/esp32ulp/esp32 cp ${test_name}.s ${out_file} echo -e "\tPatching test to work around binutils-esp32ulp .global bug" cat >> ${out_file} < ${out_file} - echo -e "\tPatching test to work around binutils-esp32ulp .global bug" + echo -e "\tPatching test to work around binutils-gdb (esp32ulp) .global bug" cat >> ${out_file} <