diff --git a/.platformio/platforms/at32/builder/frameworks/_bare.py b/.platformio/platforms/at32/builder/frameworks/_bare.py index b35a0af..3a1b88f 100644 --- a/.platformio/platforms/at32/builder/frameworks/_bare.py +++ b/.platformio/platforms/at32/builder/frameworks/_bare.py @@ -24,7 +24,7 @@ env.Append( ASFLAGS=["-x", "assembler-with-cpp"], CCFLAGS=[ - "-Os", # optimize for size + "-O3", # optimize for size "-ffunction-sections", # place each function in its own section "-fdata-sections", "-Wall", @@ -41,7 +41,7 @@ env.Append( ], LINKFLAGS=[ - "-Os", + "-O3", "-Wl,--gc-sections,--relax", "-mthumb", ], @@ -50,14 +50,15 @@ env.Append( ) #Floating point unit: hard (hardware) | softfp (software) -if ( - any(cpu in board_config.get("build.cpu") for cpu in ("cortex-m4")) -): - env.Append( - CFLAGS=["-mfpu=fpv4-sp-d16", "-mfloat-abi=hard"], - CCFLAGS=["-mfpu=fpv4-sp-d16", "-mfloat-abi=hard"], - LINKFLAGS=["-mfpu=fpv4-sp-d16", "-mfloat-abi=hard"], - ) + +#if ( +# any(cpu in board_config.get("build.cpu") for cpu in ("cortex-m4")) +#): +# env.Append( +# CFLAGS=["-mfpu=fpv4-sp-d16", "-mfloat-abi=hard"], +# CCFLAGS=["-mfpu=fpv4-sp-d16", "-mfloat-abi=hard"], +# LINKFLAGS=["-mfpu=fpv4-sp-d16", "-mfloat-abi=hard", "-u _printf_float"], +# ) if "BOARD" in env: env.Append( diff --git a/.platformio/platforms/at32/builder/frameworks/cmsis.py b/.platformio/platforms/at32/builder/frameworks/cmsis.py index 1935474..1a78486 100644 --- a/.platformio/platforms/at32/builder/frameworks/cmsis.py +++ b/.platformio/platforms/at32/builder/frameworks/cmsis.py @@ -45,10 +45,8 @@ assert product_line, "Missing MCU or Product Line field" print("-------------------------------------------------------------------------------"); print("AT32 PlatformIO porting by MartinLoren®"); print("-------------------------------------------------------------------------------"); -print("Version: 2024-12"); +print("Version: 2025-05"); -#env.SConscript("_bare.py") -#print("framework: "+"framework-cmsis-" + mcu[0:8]); CMSIS_DIR = platform.get_package_dir("framework-cmsis") if mcu.startswith("at32f43"): @@ -56,13 +54,20 @@ if mcu.startswith("at32f43"): else: CMSIS_DEVICE_DIR = platform.get_package_dir("framework-cmsis-" + mcu[0:8]) LDSCRIPTS_DIR = platform.get_package_dir("tool-ldscripts-at32") +#CMSIS_DIR = platform.get_package_dir("framework-cmsis") +#CMSIS_DEVICE_DIR = platform.get_package_dir("framework-cmsis-" + mcu[0:7]) +#LDSCRIPTS_DIR = join('%s' % platform.get_dir() or "", "ldscripts") print("Environment:"); print(" CMSIS_DIR: "+CMSIS_DIR); print(" CMSIS_DEVICE_DIR: "+CMSIS_DEVICE_DIR); print(" LDSCRIPTS_DIR: "+LDSCRIPTS_DIR); assert all(os.path.isdir(d) for d in (CMSIS_DIR, CMSIS_DEVICE_DIR, LDSCRIPTS_DIR)) + +#env.SConscript("_bare.py") #build_script = "_bare.py" + +#build_script = join(env.PioPlatform().get_package_dir("framework-cmsis-" + mcu[0:7]), "tools", "platformio", "platformio-build.py") build_script = join(CMSIS_DEVICE_DIR, "tools", "platformio", "platformio-build.py") if not isfile(build_script): sys.stderr.write("Error: Missing PlatformIO build script %s!\n" % build_script) @@ -71,9 +76,6 @@ if not isfile(build_script): SConscript(build_script) - - - def generate_ldscript(default_ldscript_path): ram = board.get("upload.maximum_ram_size", 0) flash = board.get("upload.maximum_size", 0) @@ -93,9 +95,9 @@ def generate_ldscript(default_ldscript_path): def get_linker_script(): ldscript_match = glob.glob(os.path.join( LDSCRIPTS_DIR, mcu[0:7], mcu[0:11].upper() + "*_FLASH.ld")) - #print(os.path.join(LDSCRIPTS_DIR, mcu[0:7], mcu[0:11].upper() + "*_FLASH.ld")) - + if ldscript_match and os.path.isfile(ldscript_match[0]): + print("LD Script file: " +ldscript_match[0]) return ldscript_match[0] default_ldscript = os.path.join( @@ -111,7 +113,7 @@ def get_linker_script(): def prepare_startup_file(src_path): - startup_file = os.path.join(src_path, "gcc", "startup_%s.S" % product_line.lower()) + startup_file = os.path.join(src_path, "gcc", "startup_%s.s" % product_line.lower()) print("Startup file: " + startup_file) # Change file extension to uppercase: if not os.path.isfile(startup_file) and os.path.isfile(startup_file[:-2] + ".s"): diff --git a/.platformio/platforms/at32/builder/main.py b/.platformio/platforms/at32/builder/main.py index 30b2483..d121037 100644 --- a/.platformio/platforms/at32/builder/main.py +++ b/.platformio/platforms/at32/builder/main.py @@ -235,13 +235,14 @@ elif upload_protocol == "serial": __configure_upload_port=__configure_upload_port, UPLOADER=join( '%s' % platform.get_dir() or "", - "tools", "stm32flash", "stm32flash"), + "tools", "at32flash", "at32flash"), UPLOADERFLAGS=[ "-g", board.get("upload.offset_address", "0x08000000"), "-b", env.subst("$UPLOAD_SPEED") or "115200", "-w" ], UPLOADCMD='"$UPLOADER" $UPLOADERFLAGS $SOURCE ${__configure_upload_port(__env__)}' ) + #print(env.subst("$UPLOADCMD")) upload_actions = [ env.VerboseAction(env.AutodetectUploadPort, "Looking for upload port..."), diff --git a/.platformio/platforms/at32/platform.json b/.platformio/platforms/at32/platform.json index 797a9a5..efcd0ee 100644 --- a/.platformio/platforms/at32/platform.json +++ b/.platformio/platforms/at32/platform.json @@ -18,7 +18,7 @@ "type": "git", "url": "https://github.com/platformio/platform-at32.git" }, - "version": "1.0.1", + "version": "1.0.2", "frameworks": { "cmsis": { "package": "framework-cmsis", @@ -71,7 +71,7 @@ "optional": false, "owner": "martinloren", "version": "https://github.com/martinloren/framework-cmsis-at32f43x.git" - }, + }, "tool-openocd": { "type": "uploader", "optional": true,