PlatformIO Community

Error: [API] 404 Client Error: Not Found for url

Hi there,
I need to use platformio 2.9.0 for an old project. When i started to build proccess, i got Error: [API] 404 Client Error: Not Found for url: https://api.registry.platformio.org/v2/packages/manifest message.

pio_error

Here my platformio.ini file;

[env:nucleo_f030r8]
platform = ststm32
framework = mbed
board = nucleo_f030r8

I would be grateful if you help me.

Thanks & Regards

Have you tried compiling the project with the latest PIO? You can also use platform = ...@version directives to downgrade the platform version (and with it e.g. the mbed-os and compiler version etc), see releases.

PIO 2.x seems ancient, current one is 5.x. The online APIs seem to have broken. (@ivankravets )

1 Like

Thanks for quick reply.

After update platformio to latest version, I edited the ini file as below ;

platform = ststm32
framework = mbed@5.4.0
board = nucleo_f030r8

Now, i got “board doesn’t support error” message.

pio_error_1

You can’t annotate frameworks like that, the version annotation works for platform, see docs.

If you want to use mbed-os 5.4.0, I could only find a reference to

Updated mbed framework to 5.4.5/142

in ststm32 platform version 2.1.0 (link).

However, I tried this with

[env:nucleo_f030r8]
platform = ststm32@2.1.0
framework = mbed
board = nucleo_f030r8

and while it did download the older platform, it immediately ran into the problem

PACKAGES:
 - framework-mbed 3.142.0 (1.42)
 - toolchain-gccarmnoneeabi 1.40804.0 (4.8.4)
AttributeError: 'SConsEnvironment' object has no attribute 'IsFileWithExt':
  File "C:\Users\Max\AppData\Local\Programs\Python\Python38\Lib\site-packages\platformio\builder\main.py", line 178:
    env.SConscript("$BUILD_SCRIPT")
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Script\SConscript.py", line 591:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Script\SConscript.py", line 280:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\Max\.platformio\platforms\ststm32@2.1.0\builder\main.py", line 165:
    target_elf = env.BuildProgram()
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Util.py", line 658:
    return self.method(*nargs, **kwargs)
  File "C:\Users\Max\AppData\Local\Programs\Python\Python38\Lib\site-packages\platformio\builder\tools\platformio.py", line 61:
    env.ProcessProgramDeps()
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Util.py", line 658:
    return self.method(*nargs, **kwargs)
  File "C:\Users\Max\AppData\Local\Programs\Python\Python38\Lib\site-packages\platformio\builder\tools\platformio.py", line 128:
    env.BuildFrameworks(env.get("PIOFRAMEWORK"))
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Util.py", line 658:
    return self.method(*nargs, **kwargs)
  File "C:\Users\Max\AppData\Local\Programs\Python\Python38\Lib\site-packages\platformio\builder\tools\platformio.py", line 343:
    SConscript(env.GetFrameworkScript(f), exports="env")
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Script\SConscript.py", line 654:
    return method(*args, **kw)
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Script\SConscript.py", line 591:
    return _SConscript(self.fs, *files, **subst_kw)
  File "C:\Users\Max\.platformio\packages\tool-scons\scons-local-4.1.0\SCons\Script\SConscript.py", line 280:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "C:\Users\Max\.platformio\platforms\ststm32@2.1.0\builder\frameworks\mbed\mbed.py", line 296:
    target_dirs = get_mbed_dirs_data(join(FRAMEWORK_DIR, d), ignore_dirs)
  File "C:\Users\Max\.platformio\platforms\ststm32@2.1.0\builder\frameworks\mbed\mbed.py", line 195:
    if (any(env.IsFileWithExt(f, SRC_BUILD_EXT) for f in files)):
  File "C:\Users\Max\.platformio\platforms\ststm32@2.1.0\builder\frameworks\mbed\mbed.py", line 195:
    if (any(env.IsFileWithExt(f, SRC_BUILD_EXT) for f in files)):
============================================= [FAILED] Took 172.85 seconds =============================================

Showing that tool-scons is making problems since some functions have been removed in newer versions (env.IsFileWithExt()).

I fixed it as follows

  1. Write platofrmio.ini as
[env:nucleo_f030r8]
platform = ststm32@2.1.0
board = nucleo_f030r8
framework = mbed
extra_scripts = pre:fix_build.py
  1. Create the file fix_build.py in the main directory of the project with content
Import("env")
from os.path import basename

def IsFileWithExt(file_, ext):  # pylint: disable=W0613
    if basename(file_).startswith("."):
        return False
    for e in ext:
        if file_.endswith(".%s" % e):
            return True
    return False

# expose function
env.IsFileWithExt = IsFileWithExt
  1. Build the project once. This will fail, but will download all the needed stuff. You shuold get an error like
TypeError: Unicode-objects must be encoded before hashing:
...
  File "C:\Users\Max\.platformio\platforms\ststm32@2.1.0\builder\frameworks\mbed\mbed.py", line 304:
    basename(src_dir), md5(src_dir).hexdigest()[:5]))
  1. Open the file C:\Users\<user>\.platformio\platforms\ststm32@2.1.0\builder\frameworks\mbed\mbed.py in a text editor and go to line 304.

Exchange

            basename(src_dir), md5(src_dir).hexdigest()[:5]))

with

            basename(src_dir), md5(src_dir.encode('utf-8')).hexdigest()[:5]))
  1. Rebuild the project.

This creates a successfully buildable project with that ancient mbed-os version for me.

>pio run
Processing nucleo_f030r8 (platform: ststm32@2.1.0; board: nucleo_f030r8; framework: mbed)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/nucleo_f030r8.html
PLATFORM: ST STM32 (2.1.0) > ST Nucleo F030R8
HARDWARE: STM32F030R8T6 48MHz, 8KB RAM, 64KB Flash
DEBUG: Current (stlink-v2-1) On-board (stlink-v2-1)
PACKAGES:
 - framework-mbed 3.142.0 (1.42)
 - toolchain-gccarmnoneeabi 1.40804.0 (4.8.4)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 8 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio\build\nucleo_f030r8\FrameworkMbed-hal-21f81\mbed_gpio.o
...
Compiling .pio\build\nucleo_f030r8\src\main.o
Generating LD script .pio\build\nucleo_f030r8\STM32F030X8.ld.link_script.ld
Linking .pio\build\nucleo_f030r8\firmware.elf
Checking size .pio\build\nucleo_f030r8\firmware.elf
Building .pio\build\nucleo_f030r8\firmware.bin
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [=         ]  11.1% (used 908 bytes from 8192 bytes)
Flash: [==        ]  17.6% (used 11508 bytes from 65536 bytes)
=============== [SUCCESS] Took 4.88 seconds ===============
2 Likes