Skip to content

Commit

Permalink
[ch32v003fun] Make build logic compatible with latest version
Browse files Browse the repository at this point in the history
  • Loading branch information
maxgerhardt committed Feb 9, 2025
1 parent d4050af commit 1330da1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions builder/frameworks/ch32v003fun.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from os.path import join
from os.path import join, isdir
import sys
from SCons.Script import DefaultEnvironment

Expand All @@ -17,11 +17,12 @@

# get framework directory
FRAMEWORK_DIR = platform.get_package_dir("framework-ch32v003fun")
MAIN_FUN_DIR = "ch32v003fun" if isdir(join(FRAMEWORK_DIR, "ch32v003fun")) else "ch32fun"

# Add include paths and defines
env.Append(
CPPPATH=[
join(FRAMEWORK_DIR, "ch32v003fun"),
join(FRAMEWORK_DIR, MAIN_FUN_DIR),
join(FRAMEWORK_DIR, "extralibs"),
# user will likely have the funconfig.h located in the src/ or include/ directory, so include it for the build too
"$PROJECT_SRC_DIR",
Expand Down Expand Up @@ -153,7 +154,7 @@ def get_ld_defines(chip_name: str):
"-DTARGET_MCU=%s" % target_mcu,
"-DMCU_PACKAGE=%d" % mcu_package,
"-DTARGET_MCU_LD=%d" % target_mcu_ld,
join(FRAMEWORK_DIR, "ch32v003fun", "ch32v003fun.ld"),
join(FRAMEWORK_DIR, MAIN_FUN_DIR, "ch32v003fun.ld"),
">",
join("$BUILD_DIR", "ldscript.ld")
]), "Building %s" % join("$BUILD_DIR", "ldscript.ld"))
Expand All @@ -164,5 +165,5 @@ def get_ld_defines(chip_name: str):
# build actual ch32v003fun source file
env.BuildSources(
join("$BUILD_DIR", "FrameworkCh32v003fun"),
join(FRAMEWORK_DIR, "ch32v003fun")
join(FRAMEWORK_DIR, MAIN_FUN_DIR)
)

0 comments on commit 1330da1

Please sign in to comment.