Merge branch 'hathach:master' into nxp_k64

This commit is contained in:
Michael Fischer
2024-02-04 10:55:34 +01:00
committed by GitHub
574 changed files with 32142 additions and 11950 deletions

View File

@@ -17,8 +17,8 @@ exit_status = 0
total_time = time.monotonic()
build_format = '| {:23} | {:30} | {:18} | {:7} | {:6} | {:6} |'
build_separator = '-' * 100
build_format = '| {:30} | {:30} | {:18} | {:7} | {:6} | {:6} |'
build_separator = '-' * 107
def filter_with_input(mylist):
if len(sys.argv) > 1:
@@ -26,13 +26,11 @@ def filter_with_input(mylist):
if len(input_args) > 0:
mylist[:] = input_args
# Build all examples if not specified
all_examples = []
for entry in os.scandir("examples/device"):
# Only includes example with CMakeLists.txt for esp32s, and skip board_test to speed up ci
if entry.is_dir() and os.path.exists(entry.path + "/sdkconfig.defaults") and entry.name != 'board_test':
all_examples.append(entry.name)
all_examples = [entry.replace('examples/', '') for entry in glob.glob("examples/*/*_freertos")]
filter_with_input(all_examples)
all_examples.append('device/board_test')
all_examples.sort()
# Build all boards if not specified
@@ -46,32 +44,41 @@ all_boards.sort()
def build_board(example, board):
global success_count, fail_count, skip_count, exit_status
start_time = time.monotonic()
# Check if board is skipped
build_dir = f"cmake-build/cmake-build-{board}/{example}"
# Generate and build
r = subprocess.run(f"cmake examples/{example} -B {build_dir} -G \"Ninja\" -DBOARD={board} -DMAX3421_HOST=1",
shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if r.returncode == 0:
r = subprocess.run(f"cmake --build {build_dir}", shell=True, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
build_duration = time.monotonic() - start_time
flash_size = "-"
sram_size = "-"
# Check if board is skipped
if build_utils.skip_example(example, board):
success = SKIPPED
skip_count += 1
print(build_format.format(example, board, success, '-', flash_size, sram_size))
if r.returncode == 0:
success = SUCCEEDED
success_count += 1
#(flash_size, sram_size) = build_size(example, board)
else:
subprocess.run("make -C examples/device/{} BOARD={} clean".format(example, board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
build_result = subprocess.run("make -j -C examples/device/{} BOARD={} all".format(example, board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
exit_status = r.returncode
success = FAILED
fail_count += 1
if build_result.returncode == 0:
success = SUCCEEDED
success_count += 1
(flash_size, sram_size) = build_size(example, board)
else:
exit_status = build_result.returncode
success = FAILED
fail_count += 1
title = build_format.format(example, board, success, "{:.2f}s".format(build_duration), flash_size, sram_size)
if os.getenv('CI'):
# always print build output if in CI
print(f"::group::{title}")
print(r.stdout.decode("utf-8"))
print(f"::endgroup::")
else:
# print build output if failed
print(title)
if r.returncode != 0:
print(r.stdout.decode("utf-8"))
build_duration = time.monotonic() - start_time
print(build_format.format(example, board, success, "{:.2f}s".format(build_duration), flash_size, sram_size))
if build_result.returncode != 0:
print(build_result.stdout.decode("utf-8"))
def build_size(example, board):
#elf_file = 'examples/device/{}/_build/{}/{}-firmware.elf'.format(example, board, board)
@@ -82,6 +89,7 @@ def build_size(example, board):
sram_size = int(size_list[1]) + int(size_list[2])
return (flash_size, sram_size)
print(build_separator)
print(build_format.format('Example', 'Board', '\033[39mResult\033[0m', 'Time', 'Flash', 'SRAM'))
print(build_separator)

View File

@@ -34,6 +34,7 @@ def build_family(example, family, make_option):
# sum all element of same index (column sum)
return list(map(sum, list(zip(*result))))
if __name__ == '__main__':
# IAR CC
if make_iar_option not in sys.argv:
@@ -42,7 +43,7 @@ if __name__ == '__main__':
# If examples are not specified in arguments, build all
all_examples = []
for d in os.scandir("examples"):
if d.is_dir() and 'cmake' not in d.name:
if d.is_dir() and 'cmake' not in d.name and 'build_system' not in d.name:
for entry in os.scandir(d.path):
if entry.is_dir() and 'cmake' not in entry.name:
all_examples.append(d.name + '/' + entry.name)

View File

@@ -1,17 +0,0 @@
if (TOOLCHAIN STREQUAL "gcc")
set(TOOLCHAIN_COMMON_FLAGS
-mthumb
-mcpu=cortex-m0plus
-mfloat-abi=soft
)
set(FREERTOS_PORT GCC_ARM_CM0 CACHE INTERNAL "")
elseif (TOOLCHAIN STREQUAL "iar")
set(TOOLCHAIN_COMMON_FLAGS
--cpu cortex-m0
)
set(FREERTOS_PORT IAR_ARM_CM0 CACHE INTERNAL "")
endif ()

View File

@@ -1,17 +0,0 @@
if (TOOLCHAIN STREQUAL "gcc")
set(TOOLCHAIN_COMMON_FLAGS
-mthumb
-mcpu=cortex-m0plus
-mfloat-abi=soft
)
set(FREERTOS_PORT GCC_ARM_CM0 CACHE INTERNAL "")
elseif (TOOLCHAIN STREQUAL "iar")
set(TOOLCHAIN_COMMON_FLAGS
--cpu cortex-m0
)
set(FREERTOS_PORT IAR_ARM_CM0 CACHE INTERNAL "")
endif ()

View File

@@ -1,16 +0,0 @@
if (TOOLCHAIN STREQUAL "gcc")
set(TOOLCHAIN_COMMON_FLAGS
-mthumb
-mcpu=cortex-m3
)
set(FREERTOS_PORT GCC_ARM_CM3 CACHE INTERNAL "")
elseif (TOOLCHAIN STREQUAL "iar")
set(TOOLCHAIN_COMMON_FLAGS
--cpu cortex-m3
)
set(FREERTOS_PORT IAR_ARM_CM3 CACHE INTERNAL "")
endif ()

View File

@@ -1,19 +0,0 @@
if (TOOLCHAIN STREQUAL "gcc")
set(TOOLCHAIN_COMMON_FLAGS
-mthumb
-mcpu=cortex-m33
-mfloat-abi=hard
-mfpu=fpv5-sp-d16
)
set(FREERTOS_PORT GCC_ARM_CM33_NTZ_NONSECURE CACHE INTERNAL "")
elseif (TOOLCHAIN STREQUAL "iar")
set(TOOLCHAIN_COMMON_FLAGS
--cpu cortex-m33
--fpu VFPv5-SP
)
set(FREERTOS_PORT IAR_ARM_CM4F CACHE INTERNAL "")
endif ()

View File

@@ -1,23 +0,0 @@
if (TOOLCHAIN STREQUAL "gcc")
set(TOOLCHAIN_COMMON_FLAGS
-mthumb
-mcpu=cortex-m4
-mfloat-abi=hard
-mfpu=fpv4-sp-d16
)
if (NOT DEFINED FREERTOS_PORT)
set(FREERTOS_PORT GCC_ARM_CM4F CACHE INTERNAL "")
endif ()
elseif (TOOLCHAIN STREQUAL "iar")
set(TOOLCHAIN_COMMON_FLAGS
--cpu cortex-m4
--fpu VFPv4
)
if (NOT DEFINED FREERTOS_PORT)
set(FREERTOS_PORT IAR_ARM_CM4F CACHE INTERNAL "")
endif ()
endif ()

View File

@@ -1,19 +0,0 @@
if (TOOLCHAIN STREQUAL "gcc")
set(TOOLCHAIN_COMMON_FLAGS
-mthumb
-mcpu=cortex-m7
-mfloat-abi=hard
-mfpu=fpv5-d16
)
set(FREERTOS_PORT GCC_ARM_CM7 CACHE INTERNAL "")
elseif (TOOLCHAIN STREQUAL "iar")
set(TOOLCHAIN_COMMON_FLAGS
--cpu cortex-m7
--fpu VFPv5_D16
)
set(FREERTOS_PORT IAR_ARM_CM7 CACHE INTERNAL "")
endif ()

View File

@@ -1,46 +0,0 @@
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_C_COMPILER "arm-none-eabi-gcc")
set(CMAKE_CXX_COMPILER "arm-none-eabi-g++")
set(CMAKE_ASM_COMPILER "arm-none-eabi-gcc")
set(CMAKE_SIZE "arm-none-eabi-size" CACHE FILEPATH "")
set(CMAKE_OBJCOPY "arm-none-eabi-objcopy" CACHE FILEPATH "")
set(CMAKE_OBJDUMP "arm-none-eabi-objdump" CACHE FILEPATH "")
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
# Look for includes and libraries only in the target system prefix.
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# pass TOOLCHAIN_CPU to
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_SYSTEM_PROCESSOR)
include(${CMAKE_CURRENT_LIST_DIR}/../cpu/${CMAKE_SYSTEM_PROCESSOR}.cmake)
# enable all possible warnings for building examples
list(APPEND TOOLCHAIN_COMMON_FLAGS
-fdata-sections
-ffunction-sections
-fsingle-precision-constant
-fno-strict-aliasing
)
set(TOOLCHAIN_EXE_LINKER_FLAGS
-Wl,--print-memory-usage
-Wl,--gc-sections
-Wl,--cref
)
include(${CMAKE_CURRENT_LIST_DIR}/set_flags.cmake)
# try_compile is cmake test compiling its own example,
# pass -nostdlib to skip stdlib linking
get_property(IS_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE)
if (IS_IN_TRY_COMPILE)
set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -nostdlib")
set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -nostdlib")
endif ()

View File

@@ -1,31 +0,0 @@
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_C_COMPILER "iccarm")
set(CMAKE_CXX_COMPILER "iccarm")
set(CMAKE_ASM_COMPILER "iasmarm")
set(CMAKE_SIZE "size" CACHE FILEPATH "")
set(CMAKE_OBJCOPY "ielftool" CACHE FILEPATH "")
set(CMAKE_OBJDUMP "iefdumparm" CACHE FILEPATH "")
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
# Look for includes and libraries only in the target system prefix.
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# pass TOOLCHAIN_CPU to
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_SYSTEM_PROCESSOR)
include(${CMAKE_CURRENT_LIST_DIR}/../cpu/${CMAKE_SYSTEM_PROCESSOR}.cmake)
# enable all possible warnings for building examples
list(APPEND TOOLCHAIN_COMMON_FLAGS
)
list(APPEND TOOLCHAIN_EXE_LINKER_FLAGS
)
include(${CMAKE_CURRENT_LIST_DIR}/set_flags.cmake)

View File

@@ -1,17 +0,0 @@
include(CMakePrintHelpers)
# join the toolchain flags into a single string
list(JOIN TOOLCHAIN_COMMON_FLAGS " " TOOLCHAIN_COMMON_FLAGS)
foreach (LANG IN ITEMS C CXX ASM)
set(CMAKE_${LANG}_FLAGS_INIT ${TOOLCHAIN_COMMON_FLAGS})
#cmake_print_variables(CMAKE_${LANG}_FLAGS_INIT)
# optimization flags for LOG, LOGGER ?
#set(CMAKE_${LANG}_FLAGS_RELEASE_INIT "-Os")
#set(CMAKE_${LANG}_FLAGS_DEBUG_INIT "-O0")
endforeach ()
# Linker
list(JOIN TOOLCHAIN_EXE_LINKER_FLAGS " " CMAKE_EXE_LINKER_FLAGS_INIT)

View File

@@ -11,3 +11,4 @@ attch
endianess
pris
busses
ser

View File

@@ -13,9 +13,9 @@ TOP = Path(__file__).parent.parent.resolve()
def gen_deps_doc():
deps_rst = Path(TOP) / "docs/reference/dependencies.rst"
df = pd.DataFrame.from_dict(deps_all, orient='index', columns=['Commit', 'Project'])
df = df[['Project', 'Commit']].sort_index()
df = df.rename_axis("Path")
df = pd.DataFrame.from_dict(deps_all, orient='index', columns=['Repo', 'Commit', 'Required by'])
df = df[['Repo', 'Commit', 'Required by']].sort_index()
df = df.rename_axis("Local Path")
outstr = f"""\
************

View File

@@ -7,7 +7,7 @@ from multiprocessing import Pool
# path, url, commit, family (Alphabet sorted by path)
deps_mandatory = {
'lib/FreeRTOS-Kernel': ['https://github.com/FreeRTOS/FreeRTOS-Kernel.git',
'5f19e34f878af97810a7662a75eac59bd74d628b',
'cc0e0707c0c748713485b870bb980852b210877f',
'all'],
'lib/lwip': ['https://github.com/lwip-tcpip/lwip.git',
'159e31b689577dbf69cf0683bbaffbd71fa5ee10',
@@ -54,7 +54,7 @@ deps_optional = {
'950819b7de9b32f92c3edf396bc5ffb8d66e7009',
'kinetis_k kinetis_k32l2 kinetis_kl lpc51 lpc54 lpc55 mcx imxrt'],
'hw/mcu/raspberry_pi/Pico-PIO-USB': ['https://github.com/sekigon-gonnoc/Pico-PIO-USB.git',
'd00a10a8c425d0d40f81b87169102944b01f3bb3',
'0f747aaa0c16f750bdfa2ba37ec25d6c8e1bc117',
'rp2040'],
'hw/mcu/renesas/fsp': ['https://github.com/renesas/fsp.git',
'd52e5a6a59b7c638da860c2bb309b6e78e752ff8',
@@ -95,6 +95,9 @@ deps_optional = {
'hw/mcu/st/cmsis_device_h7': ['https://github.com/STMicroelectronics/cmsis_device_h7.git',
'60dc2c913203dc8629dc233d4384dcc41c91e77f',
'stm32h7'],
'hw/mcu/st/cmsis_device_h5': ['https://github.com/STMicroelectronics/cmsis_device_h5.git',
'62b2cb0fbfe10c5791ee469bbde7b397c2fea8f5',
'stm32h5'],
'hw/mcu/st/cmsis_device_l0': ['https://github.com/STMicroelectronics/cmsis_device_l0.git',
'06748ca1f93827befdb8b794402320d94d02004f',
'stm32l0'],
@@ -108,7 +111,7 @@ deps_optional = {
'd922865fc0326a102c26211c44b8e42f52c1e53d',
'stm32l5'],
'hw/mcu/st/cmsis_device_u5': ['https://github.com/STMicroelectronics/cmsis_device_u5.git',
'bc00f3c9d8a4e25220f84c26d414902cc6bdf566',
'06d7edade7167b0eafdd550bf77cfc4fa98eae2e',
'stm32u5'],
'hw/mcu/st/cmsis_device_wb': ['https://github.com/STMicroelectronics/cmsis_device_wb.git',
'9c5d1920dd9fabbe2548e10561d63db829bb744f',
@@ -140,6 +143,9 @@ deps_optional = {
'hw/mcu/st/stm32h7xx_hal_driver': ['https://github.com/STMicroelectronics/stm32h7xx_hal_driver.git',
'd8461b980b59b1625207d8c4f2ce0a9c2a7a3b04',
'stm32h7'],
'hw/mcu/st/stm32h5xx_hal_driver': ['https://github.com/STMicroelectronics/stm32h5xx_hal_driver.git',
'2cf77de584196d619cec1b4586c3b9e2820a254e',
'stm32h5'],
'hw/mcu/st/stm32l0xx_hal_driver': ['https://github.com/STMicroelectronics/stm32l0xx_hal_driver.git',
'fbdacaf6f8c82a4e1eb9bd74ba650b491e97e17b',
'stm32l0'],
@@ -153,7 +159,7 @@ deps_optional = {
'675c32a75df37f39d50d61f51cb0dcf53f07e1cb',
'stm32l5'],
'hw/mcu/st/stm32u5xx_hal_driver': ['https://github.com/STMicroelectronics/stm32u5xx_hal_driver.git',
'2e1d4cdb386e33391cb261dfff4fefa92e4aa35a',
'4d93097a67928e9377e655ddd14622adc31b9770',
'stm32u5'],
'hw/mcu/st/stm32wbxx_hal_driver': ['https://github.com/STMicroelectronics/stm32wbxx_hal_driver.git',
'2c5f06638be516c1b772f768456ba637f077bac8',
@@ -164,10 +170,13 @@ deps_optional = {
'hw/mcu/wch/ch32v307': ['https://github.com/openwch/ch32v307.git',
'17761f5cf9dbbf2dcf665b7c04934188add20082',
'ch32v307'],
'hw/mcu/wch/ch32f20x': ['https://github.com/openwch/ch32f20x.git',
'77c4095087e5ed2c548ec9058e655d0b8757663b',
'ch32f20x'],
'lib/CMSIS_5': ['https://github.com/ARM-software/CMSIS_5.git',
'20285262657d1b482d132d20d755c8c330d55c1f',
'imxrt kinetis_k32l2 kinetis_kl lpc51 lpc54 lpc55 mcx mm32 msp432e4 nrf ra saml2x'
'stm32f0 stm32f1 stm32f2 stm32f3 stm32f4 stm32f7 stm32g0 stm32g4 '
'stm32f0 stm32f1 stm32f2 stm32f3 stm32f4 stm32f7 stm32g0 stm32g4 stm32h5'
'stm32h7 stm32l0 stm32l1 stm32l4 stm32l5 stm32u5 stm32wb'],
'lib/sct_neopixel': ['https://github.com/gsteiert/sct_neopixel.git',
'e73e04ca63495672d955f9268e003cffe168fcd8',
@@ -181,6 +190,10 @@ deps_all = {**deps_mandatory, **deps_optional}
TOP = Path(__file__).parent.parent.resolve()
def run_cmd(cmd):
return subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
def get_a_dep(d):
if d not in deps_all.keys():
print('{} is not found in dependency list')
@@ -189,25 +202,24 @@ def get_a_dep(d):
commit = deps_all[d][1]
families = deps_all[d][2]
print('cloning {} with {}'.format(d, url))
print(f'cloning {d} with {url}')
p = Path(TOP / d)
git_cmd = "git -C {}".format(p)
git_cmd = f"git -C {p}"
# Init git deps if not existed
if not p.exists():
p.mkdir(parents=True)
subprocess.run("{} init".format(git_cmd), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
subprocess.run("{} remote add origin {}".format(git_cmd, url), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
run_cmd(f"{git_cmd} init")
run_cmd(f"{git_cmd} remote add origin {url}")
# Check if commit is already fetched
result = subprocess.run("{} rev-parse HEAD".format(git_cmd, commit), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
result = run_cmd(f"{git_cmd} rev-parse HEAD")
head = result.stdout.decode("utf-8").splitlines()[0]
run_cmd(f"{git_cmd} reset --hard")
if commit != head:
subprocess.run("{} reset --hard".format(git_cmd, commit), shell=True)
subprocess.run("{} fetch --depth 1 origin {}".format(git_cmd, commit), shell=True)
subprocess.run("{} checkout FETCH_HEAD".format(git_cmd), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
run_cmd(f"{git_cmd} fetch --depth 1 origin {commit}")
run_cmd(f"{git_cmd} checkout FETCH_HEAD")
return 0

View File

@@ -1,51 +1,84 @@
#!/usr/bin/python3
import os
import sys
import xml.dom.minidom as XML
import glob
# Read base configuration
base = ""
with open("iar_template.ipcf") as f:
base = f.read()
def Main():
# Read base configuration
base = ""
with open("iar_template.ipcf") as f:
base = f.read()
# Enumerate all device/host examples
dir_1 = os.listdir("../examples")
for dir_2 in dir_1:
if os.path.isdir("../examples/{}".format(dir_2)):
print(dir_2)
examples = os.listdir("../examples/{}".format(dir_2))
for example in examples:
if os.path.isdir("../examples/{}/{}".format(dir_2, example)):
print("../examples/{}/{}".format(dir_2, example))
conf = XML.parseString(base)
files = conf.getElementsByTagName("files")[0]
inc = conf.getElementsByTagName("includePath")[0]
# Add bsp inc
path = conf.createElement('path')
path_txt = conf.createTextNode("$TUSB_DIR$/hw")
path.appendChild(path_txt)
inc.appendChild(path)
# Add board.c/.h
grp = conf.createElement('group')
grp.setAttribute("name", "bsp")
path = conf.createElement('path')
path_txt = conf.createTextNode("$TUSB_DIR$/hw/bsp/board.c")
path.appendChild(path_txt)
grp.appendChild(path)
files.appendChild(grp)
# Add example's .c/.h
grp = conf.createElement('group')
grp.setAttribute("name", "example")
for file in os.listdir("../examples/{}/{}/src".format(dir_2, example)):
if file.endswith(".c") or file.endswith(".h"):
path = conf.createElement('path')
path.setAttribute("copyTo", "$PROJ_DIR$/{}".format(file))
path_txt = conf.createTextNode("$TUSB_DIR$/examples/{0}/{1}/src/{2}".format(dir_2, example, file))
path.appendChild(path_txt)
grp.appendChild(path)
files.appendChild(grp)
cfg_str = conf.toprettyxml()
cfg_str = '\n'.join([s for s in cfg_str.splitlines() if s.strip()])
#print(cfg_str)
with open("../examples/{0}/{1}/iar_{1}.ipcf".format(dir_2, example), 'w') as f:
f.write(cfg_str)
# Enumerate all device/host examples
dir_1 = os.listdir("../examples")
for dir_2 in dir_1:
if os.path.isdir("../examples/{}".format(dir_2)):
print(dir_2)
examples = os.listdir("../examples/{}".format(dir_2))
for example in examples:
if os.path.isdir("../examples/{}/{}".format(dir_2, example)):
print("../examples/{}/{}".format(dir_2, example))
conf = XML.parseString(base)
files = conf.getElementsByTagName("files")[0]
inc = conf.getElementsByTagName("includePath")[0]
# Add bsp inc
path = conf.createElement('path')
path_txt = conf.createTextNode("$TUSB_DIR$/hw")
path.appendChild(path_txt)
inc.appendChild(path)
# Add board.c/.h
grp = conf.createElement('group')
grp.setAttribute("name", "bsp")
path = conf.createElement('path')
path_txt = conf.createTextNode("$TUSB_DIR$/hw/bsp/board.c")
path.appendChild(path_txt)
grp.appendChild(path)
files.appendChild(grp)
# Add example's .c/.h
grp = conf.createElement('group')
grp.setAttribute("name", "example")
for file in os.listdir("../examples/{}/{}/src".format(dir_2, example)):
if file.endswith(".c") or file.endswith(".h"):
path = conf.createElement('path')
path.setAttribute("copyTo", "$PROJ_DIR$/{}".format(file))
path_txt = conf.createTextNode("$TUSB_DIR$/examples/{0}/{1}/src/{2}".format(dir_2, example, file))
path.appendChild(path_txt)
grp.appendChild(path)
files.appendChild(grp)
cfg_str = conf.toprettyxml()
cfg_str = '\n'.join([s for s in cfg_str.splitlines() if s.strip()])
#print(cfg_str)
with open("../examples/{0}/{1}/iar_{1}.ipcf".format(dir_2, example), 'w') as f:
f.write(cfg_str)
def ListPath(path, blacklist=[]):
# Get all .c files
files = glob.glob(f'../{path}/**/*.c', recursive=True)
# Filter
files = [x for x in files if all(y not in x for y in blacklist)]
# Get common dir list
dirs = []
for file in files:
dir = os.path.dirname(file)
if dir not in dirs:
dirs.append(dir)
# Print .c grouped by dir
for dir in dirs:
print('<group name="' + dir.replace('../', '').replace('\\','/') + '">')
for file in files:
if os.path.dirname(file) == dir:
print(' <path>$TUSB_DIR$/' + file.replace('../','').replace('\\','/')+'</path>')
print('</group>')
def List():
ListPath('src', [ 'template.c', 'dcd_synopsys.c', 'dcd_esp32sx.c' ])
ListPath('lib/SEGGER_RTT')
if __name__ == "__main__":
if (len(sys.argv) > 1):
if (sys.argv[1] == 'l'):
List()
else:
Main()

View File

@@ -4,166 +4,176 @@
<includePath>
<path>$TUSB_DIR$/src</path>
<path>$TUSB_DIR$/lib/SEGGER_RTT/RTT</path>
<path>$TUSB_DIR$/lib/SEGGER_RTT/Config</path>
<path>$PROJ_DIR$</path>
</includePath>
<files>
<group name="src/device">
<path>$TUSB_DIR$/src/device/usbd.c</path>
<path>$TUSB_DIR$/src/device/usbd_control.c</path>
</group>
<group name="src/common">
<path>$TUSB_DIR$/src/common/tusb_fifo.c</path>
</group>
<group name="src/class/audio">
<path>$TUSB_DIR$/src/class/audio/audio_device.c</path>
</group>
<group name="src/class/bth">
<path>$TUSB_DIR$/src/class/bth/bth_device.c</path>
</group>
<group name="src/class/cdc">
<path>$TUSB_DIR$/src/class/cdc/cdc_device.c</path>
<path>$TUSB_DIR$/src/class/cdc/cdc_host.c</path>
<path>$TUSB_DIR$/src/class/cdc/cdc_rndis_host.c</path>
</group>
<group name="src/class/dfu">
<path>$TUSB_DIR$/src/class/dfu/dfu_device.c</path>
<path>$TUSB_DIR$/src/class/dfu/dfu_rt_device.c</path>
</group>
<group name="src/class/hid">
<path>$TUSB_DIR$/src/class/hid/hid_device.c</path>
<path>$TUSB_DIR$/src/class/hid/hid_host.c</path>
</group>
<group name="src/class/midi">
<path>$TUSB_DIR$/src/class/midi/midi_device.c</path>
</group>
<group name="src/class/msc">
<path>$TUSB_DIR$/src/class/msc/msc_device.c</path>
<path>$TUSB_DIR$/src/class/msc/msc_host.c</path>
</group>
<group name="src/class/net">
<path>$TUSB_DIR$/src/class/net/ecm_rndis_device.c</path>
<path>$TUSB_DIR$/src/class/net/ncm_device.c</path>
</group>
<group name="src/class/usbtmc">
<path>$TUSB_DIR$/src/class/usbtmc/usbtmc_device.c</path>
</group>
<group name="src/class/vendor">
<path>$TUSB_DIR$/src/class/vendor/vendor_device.c</path>
<path>$TUSB_DIR$/src/class/vendor/vendor_host.c</path>
</group>
<group name="src">
<path>$TUSB_DIR$/src/tusb.c</path>
</group>
<group name="src/host">
<path>$TUSB_DIR$/src/host/hub.c</path>
<path>$TUSB_DIR$/src/host/usbh.c</path>
</group>
<group name="src/portable/bridgetek/ft9xx">
<path>$TUSB_DIR$/src/portable/bridgetek/ft9xx/dcd_ft9xx.c</path>
</group>
<group name="src/portable/chipidea/ci_hs">
<path>$TUSB_DIR$/src/portable/chipidea/ci_hs/dcd_ci_hs.c</path>
<path>$TUSB_DIR$/src/portable/chipidea/ci_hs/hcd_ci_hs.c</path>
</group>
<group name="src/portable/synopsys/dwc2">
<path>$TUSB_DIR$/src/portable/synopsys/dwc2/dcd_dwc2.c</path>
</group>
<group name="src/portable/dialog/da146xx">
<path>$TUSB_DIR$/src/portable/dialog/da146xx/dcd_da146xx.c</path>
</group>
<group name="src/portable/ehci">
<path>$TUSB_DIR$/src/portable/ehci/ehci.c</path>
</group>
<group name="src/portable/espressif/esp32sx">
<path>$TUSB_DIR$/src/portable/espressif/esp32sx/dcd_esp32sx.c</path>
</group>
<group name="src/portable/mentor/musb">
<path>$TUSB_DIR$/src/portable/mentor/musb/dcd_musb.c</path>
<path>$TUSB_DIR$/src/portable/mentor/musb/hcd_musb.c</path>
</group>
<group name="src/portable/microchip/samd">
<path>$TUSB_DIR$/src/portable/microchip/samd/dcd_samd.c</path>
</group>
<group name="src/portable/microchip/samg">
<path>$TUSB_DIR$/src/portable/microchip/samg/dcd_samg.c</path>
</group>
<group name="src/portable/microchip/samx7x">
<path>$TUSB_DIR$/src/portable/microchip/samx7x/dcd_samx7x.c</path>
</group>
<group name="src/portable/microchip/pic">
<path>$TUSB_DIR$/src/portable/microchip/pic/dcd_pic.c</path>
</group>
<group name="src/portable/microchip/pic32mz">
<path>$TUSB_DIR$/src/portable/microchip/pic32mz/dcd_pic32mz.c</path>
</group>
<group name="src/portable/mindmotion/mm32">
<path>$TUSB_DIR$/src/portable/mindmotion/mm32/dcd_mm32f327x_otg.c</path>
</group>
<group name="src/portable/nordic/nrf5x">
<path>$TUSB_DIR$/src/portable/nordic/nrf5x/dcd_nrf5x.c</path>
</group>
<group name="src/portable/nuvoton/nuc120">
<path>$TUSB_DIR$/src/portable/nuvoton/nuc120/dcd_nuc120.c</path>
</group>
<group name="src/portable/nuvoton/nuc121">
<path>$TUSB_DIR$/src/portable/nuvoton/nuc121/dcd_nuc121.c</path>
</group>
<group name="src/portable/nuvoton/nuc505">
<path>$TUSB_DIR$/src/portable/nuvoton/nuc505/dcd_nuc505.c</path>
</group>
<group name="src/portable/nxp/khci">
<path>$TUSB_DIR$/src/portable/nxp/khci/dcd_khci.c</path>
<path>$TUSB_DIR$/src/portable/nxp/khci/hcd_khci.c</path>
</group>
<group name="src/portable/nxp/lpc17_40">
<path>$TUSB_DIR$/src/portable/nxp/lpc17_40/dcd_lpc17_40.c</path>
<path>$TUSB_DIR$/src/portable/nxp/lpc17_40/hcd_lpc17_40.c</path>
</group>
<group name="src/portable/nxp/lpc_ip3511">
<path>$TUSB_DIR$/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c</path>
</group>
<group name="src/portable/nxp/transdimension">
<path>$TUSB_DIR$/src/portable/nxp/transdimension/dcd_transdimension.c</path>
<path>$TUSB_DIR$/src/portable/nxp/transdimension/hcd_transdimension.c</path>
</group>
<group name="src/portable/ohci">
<path>$TUSB_DIR$/src/portable/ohci/ohci.c</path>
</group>
<group name="src/portable/raspberrypi/pio_usb">
<path>$TUSB_DIR$/src/portable/raspberrypi/pio_usb/dcd_pio_usb.c</path>
<path>$TUSB_DIR$/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c</path>
</group>
<group name="src/portable/raspberrypi/rp2040">
<path>$TUSB_DIR$/src/portable/raspberrypi/rp2040/dcd_rp2040.c</path>
<path>$TUSB_DIR$/src/portable/raspberrypi/rp2040/hcd_rp2040.c</path>
</group>
<group name="src/portable/renesas/rusb2">
<path>$TUSB_DIR$/src/portable/renesas/rusb2/dcd_rusb2.c</path>
<path>$TUSB_DIR$/src/portable/renesas/rusb2/hcd_rusb2.c</path>
</group>
<group name="src/portable/sony/cxd56">
<path>$TUSB_DIR$/src/portable/sony/cxd56/dcd_cxd56.c</path>
</group>
<group name="src/portable/st/stm32_fsdev">
<path>$TUSB_DIR$/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c</path>
</group>
<group name="src/portable/sunxi">
<path>$TUSB_DIR$/src/portable/sunxi/dcd_sunxi_musb.c</path>
</group>
<group name="src/portable/ti/msp430x5xx">
<path>$TUSB_DIR$/src/portable/ti/msp430x5xx/dcd_msp430x5xx.c</path>
</group>
<group name="src/portable/valentyusb/eptri">
<path>$TUSB_DIR$/src/portable/valentyusb/eptri/dcd_eptri.c</path>
</group>
<group name="src/portable/wch/ch32v307">
<path>$TUSB_DIR$/src/portable/wch/ch32v307/dcd_usbhs.c</path>
</group>
<group name="lib/SEGGER_RTT">
<path>$TUSB_DIR$/lib/SEGGER_RTT/RTT/SEGGER_RTT.c</path>
<group name="src/class/audio">
<path>$TUSB_DIR$/src/class/audio/audio_device.c</path>
</group>
<group name="src/class/bth">
<path>$TUSB_DIR$/src/class/bth/bth_device.c</path>
</group>
<group name="src/class/cdc">
<path>$TUSB_DIR$/src/class/cdc/cdc_device.c</path>
<path>$TUSB_DIR$/src/class/cdc/cdc_host.c</path>
<path>$TUSB_DIR$/src/class/cdc/cdc_rndis_host.c</path>
</group>
<group name="src/class/dfu">
<path>$TUSB_DIR$/src/class/dfu/dfu_device.c</path>
<path>$TUSB_DIR$/src/class/dfu/dfu_rt_device.c</path>
</group>
<group name="src/class/hid">
<path>$TUSB_DIR$/src/class/hid/hid_device.c</path>
<path>$TUSB_DIR$/src/class/hid/hid_host.c</path>
</group>
<group name="src/class/midi">
<path>$TUSB_DIR$/src/class/midi/midi_device.c</path>
</group>
<group name="src/class/msc">
<path>$TUSB_DIR$/src/class/msc/msc_device.c</path>
<path>$TUSB_DIR$/src/class/msc/msc_host.c</path>
</group>
<group name="src/class/net">
<path>$TUSB_DIR$/src/class/net/ecm_rndis_device.c</path>
<path>$TUSB_DIR$/src/class/net/ncm_device.c</path>
</group>
<group name="src/class/usbtmc">
<path>$TUSB_DIR$/src/class/usbtmc/usbtmc_device.c</path>
</group>
<group name="src/class/vendor">
<path>$TUSB_DIR$/src/class/vendor/vendor_device.c</path>
<path>$TUSB_DIR$/src/class/vendor/vendor_host.c</path>
</group>
<group name="src/class/video">
<path>$TUSB_DIR$/src/class/video/video_device.c</path>
</group>
<group name="src/common">
<path>$TUSB_DIR$/src/common/tusb_fifo.c</path>
</group>
<group name="src/device">
<path>$TUSB_DIR$/src/device/usbd.c</path>
<path>$TUSB_DIR$/src/device/usbd_control.c</path>
</group>
<group name="src/host">
<path>$TUSB_DIR$/src/host/hub.c</path>
<path>$TUSB_DIR$/src/host/usbh.c</path>
</group>
<group name="src/portable/analog/max3421">
<path>$TUSB_DIR$/src/portable/analog/max3421/hcd_max3421.c</path>
</group>
<group name="src/portable/bridgetek/ft9xx">
<path>$TUSB_DIR$/src/portable/bridgetek/ft9xx/dcd_ft9xx.c</path>
</group>
<group name="src/portable/chipidea/ci_fs">
<path>$TUSB_DIR$/src/portable/chipidea/ci_fs/dcd_ci_fs.c</path>
</group>
<group name="src/portable/chipidea/ci_hs">
<path>$TUSB_DIR$/src/portable/chipidea/ci_hs/dcd_ci_hs.c</path>
<path>$TUSB_DIR$/src/portable/chipidea/ci_hs/hcd_ci_hs.c</path>
</group>
<group name="src/portable/dialog/da146xx">
<path>$TUSB_DIR$/src/portable/dialog/da146xx/dcd_da146xx.c</path>
</group>
<group name="src/portable/ehci">
<path>$TUSB_DIR$/src/portable/ehci/ehci.c</path>
</group>
<group name="src/portable/mentor/musb">
<path>$TUSB_DIR$/src/portable/mentor/musb/dcd_musb.c</path>
<path>$TUSB_DIR$/src/portable/mentor/musb/hcd_musb.c</path>
</group>
<group name="src/portable/microchip/pic">
<path>$TUSB_DIR$/src/portable/microchip/pic/dcd_pic.c</path>
</group>
<group name="src/portable/microchip/pic32mz">
<path>$TUSB_DIR$/src/portable/microchip/pic32mz/dcd_pic32mz.c</path>
</group>
<group name="src/portable/microchip/samd">
<path>$TUSB_DIR$/src/portable/microchip/samd/dcd_samd.c</path>
</group>
<group name="src/portable/microchip/samg">
<path>$TUSB_DIR$/src/portable/microchip/samg/dcd_samg.c</path>
</group>
<group name="src/portable/microchip/samx7x">
<path>$TUSB_DIR$/src/portable/microchip/samx7x/dcd_samx7x.c</path>
</group>
<group name="src/portable/mindmotion/mm32">
<path>$TUSB_DIR$/src/portable/mindmotion/mm32/dcd_mm32f327x_otg.c</path>
</group>
<group name="src/portable/nordic/nrf5x">
<path>$TUSB_DIR$/src/portable/nordic/nrf5x/dcd_nrf5x.c</path>
</group>
<group name="src/portable/nuvoton/nuc120">
<path>$TUSB_DIR$/src/portable/nuvoton/nuc120/dcd_nuc120.c</path>
</group>
<group name="src/portable/nuvoton/nuc121">
<path>$TUSB_DIR$/src/portable/nuvoton/nuc121/dcd_nuc121.c</path>
</group>
<group name="src/portable/nuvoton/nuc505">
<path>$TUSB_DIR$/src/portable/nuvoton/nuc505/dcd_nuc505.c</path>
</group>
<group name="src/portable/nxp/khci">
<path>$TUSB_DIR$/src/portable/nxp/khci/dcd_khci.c</path>
<path>$TUSB_DIR$/src/portable/nxp/khci/hcd_khci.c</path>
</group>
<group name="src/portable/nxp/lpc17_40">
<path>$TUSB_DIR$/src/portable/nxp/lpc17_40/dcd_lpc17_40.c</path>
<path>$TUSB_DIR$/src/portable/nxp/lpc17_40/hcd_lpc17_40.c</path>
</group>
<group name="src/portable/nxp/lpc_ip3511">
<path>$TUSB_DIR$/src/portable/nxp/lpc_ip3511/dcd_lpc_ip3511.c</path>
</group>
<group name="src/portable/ohci">
<path>$TUSB_DIR$/src/portable/ohci/ohci.c</path>
</group>
<group name="src/portable/raspberrypi/pio_usb">
<path>$TUSB_DIR$/src/portable/raspberrypi/pio_usb/dcd_pio_usb.c</path>
<path>$TUSB_DIR$/src/portable/raspberrypi/pio_usb/hcd_pio_usb.c</path>
</group>
<group name="src/portable/raspberrypi/rp2040">
<path>$TUSB_DIR$/src/portable/raspberrypi/rp2040/dcd_rp2040.c</path>
<path>$TUSB_DIR$/src/portable/raspberrypi/rp2040/hcd_rp2040.c</path>
<path>$TUSB_DIR$/src/portable/raspberrypi/rp2040/rp2040_usb.c</path>
</group>
<group name="src/portable/renesas/rusb2">
<path>$TUSB_DIR$/src/portable/renesas/rusb2/dcd_rusb2.c</path>
<path>$TUSB_DIR$/src/portable/renesas/rusb2/hcd_rusb2.c</path>
<path>$TUSB_DIR$/src/portable/renesas/rusb2/rusb2_common.c</path>
</group>
<group name="src/portable/sony/cxd56">
<path>$TUSB_DIR$/src/portable/sony/cxd56/dcd_cxd56.c</path>
</group>
<group name="src/portable/st/stm32_fsdev">
<path>$TUSB_DIR$/src/portable/st/stm32_fsdev/dcd_stm32_fsdev.c</path>
</group>
<group name="src/portable/st/typec">
<path>$TUSB_DIR$/src/portable/st/typec/typec_stm32.c</path>
</group>
<group name="src/portable/sunxi">
<path>$TUSB_DIR$/src/portable/sunxi/dcd_sunxi_musb.c</path>
</group>
<group name="src/portable/synopsys/dwc2">
<path>$TUSB_DIR$/src/portable/synopsys/dwc2/dcd_dwc2.c</path>
</group>
<group name="src/portable/ti/msp430x5xx">
<path>$TUSB_DIR$/src/portable/ti/msp430x5xx/dcd_msp430x5xx.c</path>
</group>
<group name="src/portable/valentyusb/eptri">
<path>$TUSB_DIR$/src/portable/valentyusb/eptri/dcd_eptri.c</path>
</group>
<group name="src/portable/wch">
<path>$TUSB_DIR$/src/portable/wch/dcd_ch32_usbhs.c</path>
</group>
<group name="src/typec">
<path>$TUSB_DIR$/src/typec/usbc.c</path>
</group>
<group name="lib/SEGGER_RTT/RTT">
<path>$TUSB_DIR$/lib/SEGGER_RTT/RTT/SEGGER_RTT.c</path>
<path>$TUSB_DIR$/lib/SEGGER_RTT/RTT/SEGGER_RTT_printf.c</path>
<path>$TUSB_DIR$/lib/SEGGER_RTT/Syscalls/SEGGER_RTT_Syscalls_IAR.c</path>
</group>
</group>
</files>
</iarProjectConnection>

View File

@@ -1,9 +0,0 @@
ifeq ($(TOOLCHAIN),gcc)
CFLAGS += \
-mcpu=arm1176jzf-s \
else ifeq ($(TOOLCHAIN),iar)
#CFLAGS += --cpu cortex-a53
#ASFLAGS += --cpu cortex-a53
endif

View File

@@ -1,12 +0,0 @@
ifeq ($(TOOLCHAIN),gcc)
CFLAGS += \
-mcpu=cortex-a53 \
else ifeq ($(TOOLCHAIN),iar)
CFLAGS += \
--cpu cortex-a53 \
ASFLAGS += \
--cpu cortex-a53 \
endif

View File

@@ -1,12 +0,0 @@
ifeq ($(TOOLCHAIN),gcc)
CFLAGS += \
-mcpu=cortex-a72 \
else ifeq ($(TOOLCHAIN),iar)
CFLAGS += \
--cpu cortex-a72 \
ASFLAGS += \
--cpu cortex-a72 \
endif

View File

@@ -1,14 +0,0 @@
ifeq ($(TOOLCHAIN),gcc)
CFLAGS += \
-mthumb \
-mcpu=cortex-m0 \
-mfloat-abi=soft \
else ifeq ($(TOOLCHAIN),iar)
# IAR Flags
CFLAGS += --cpu cortex-m0
ASFLAGS += --cpu cortex-m0
endif
# For freeRTOS port source
FREERTOS_PORTABLE_SRC ?= $(FREERTOS_PORTABLE_PATH)/ARM_CM0

View File

@@ -1,14 +0,0 @@
ifeq ($(TOOLCHAIN),gcc)
CFLAGS += \
-mthumb \
-mcpu=cortex-m0plus \
-mfloat-abi=soft \
else ifeq ($(TOOLCHAIN),iar)
# IAR Flags
CFLAGS += --cpu cortex-m0+
ASFLAGS += --cpu cortex-m0+
endif
# For freeRTOS port source
FREERTOS_PORTABLE_SRC ?= $(FREERTOS_PORTABLE_PATH)/ARM_CM0

View File

@@ -1,17 +0,0 @@
ifeq ($(TOOLCHAIN),gcc)
CFLAGS += \
-mthumb \
-mcpu=cortex-m3 \
-mfloat-abi=soft \
else ifeq ($(TOOLCHAIN),iar)
# IAR Flags
CFLAGS += \
--cpu cortex-m3 \
ASFLAGS += \
--cpu cortex-m3
endif
# For freeRTOS port source
FREERTOS_PORTABLE_SRC ?= $(FREERTOS_PORTABLE_PATH)/ARM_CM3

View File

@@ -1,19 +0,0 @@
ifeq ($(TOOLCHAIN),gcc)
CFLAGS += \
-mthumb \
-mcpu=cortex-m33 \
-mfloat-abi=hard \
-mfpu=fpv5-sp-d16 \
else ifeq ($(TOOLCHAIN),iar)
CFLAGS += \
--cpu cortex-m33 \
--fpu VFPv5-SP \
ASFLAGS += \
--cpu cortex-m33 \
--fpu VFPv5-SP \
endif
FREERTOS_PORTABLE_SRC ?= $(FREERTOS_PORTABLE_PATH)/ARM_CM33_NTZ/non_secure

View File

@@ -1,13 +0,0 @@
ifeq ($(TOOLCHAIN),gcc)
CFLAGS += \
-mthumb \
-mcpu=cortex-m4 \
-mfloat-abi=hard \
-mfpu=fpv4-sp-d16 \
else ifeq ($(TOOLCHAIN),iar)
CFLAGS += --cpu cortex-m4 --fpu VFPv4
ASFLAGS += --cpu cortex-m4 --fpu VFPv4
endif
FREERTOS_PORTABLE_SRC ?= $(FREERTOS_PORTABLE_PATH)/ARM_CM4F

View File

@@ -1,19 +0,0 @@
ifeq ($(TOOLCHAIN),gcc)
CFLAGS += \
-mthumb \
-mcpu=cortex-m7 \
-mfloat-abi=hard \
-mfpu=fpv5-d16 \
else ifeq ($(TOOLCHAIN),iar)
CFLAGS += \
--cpu cortex-m7 \
--fpu VFPv5_D16 \
ASFLAGS += \
--cpu cortex-m7 \
--fpu VFPv5_D16 \
endif
FREERTOS_PORTABLE_SRC ?= $(FREERTOS_PORTABLE_PATH)/ARM_CM7/r0p1

View File

@@ -1,71 +0,0 @@
# makefile for arm gcc toolchain
CC = $(CROSS_COMPILE)gcc
CXX = $(CROSS_COMPILE)g++
AS = $(CC) -x assembler-with-cpp
LD = $(CC)
GDB = $(CROSS_COMPILE)gdb
OBJCOPY = $(CROSS_COMPILE)objcopy
SIZE = $(CROSS_COMPILE)size
# ---------------------------------------
# Compiler Flags
# ---------------------------------------
CFLAGS += \
-MD \
-ggdb \
-fdata-sections \
-ffunction-sections \
-fsingle-precision-constant \
-fno-strict-aliasing \
-Wall \
-Wextra \
-Werror \
-Wfatal-errors \
-Wdouble-promotion \
-Wstrict-prototypes \
-Wstrict-overflow \
-Werror-implicit-function-declaration \
-Wfloat-equal \
-Wundef \
-Wshadow \
-Wwrite-strings \
-Wsign-compare \
-Wmissing-format-attribute \
-Wunreachable-code \
-Wcast-align \
-Wcast-function-type \
-Wcast-qual \
-Wnull-dereference \
-Wuninitialized \
-Wunused \
-Wreturn-type \
-Wredundant-decls \
# conversion is too strict for most mcu driver, may be disable sign/int/arith-conversion
# -Wconversion
# Size Optimization as default
CFLAGS_OPTIMIZED ?= -Os
# Debugging/Optimization
ifeq ($(DEBUG), 1)
CFLAGS += -O0
NO_LTO = 1
else
CFLAGS += $(CFLAGS_OPTIMIZED)
endif
# ---------------------------------------
# Linker Flags
# ---------------------------------------
LDFLAGS += \
-Wl,-Map=$@.map \
-Wl,-cref \
-Wl,-gc-sections \
# Some toolchain such as renesas rx does not support --print-memory-usage flags
ifneq ($(FAMILY),rx)
LDFLAGS += -Wl,--print-memory-usage
endif

View File

@@ -1,79 +0,0 @@
SRC_S += $(SRC_S_GCC)
# Assembly files can be name with upper case .S, convert it to .s
SRC_S := $(SRC_S:.S=.s)
# Due to GCC LTO bug https://bugs.launchpad.net/gcc-arm-embedded/+bug/1747966
# assembly file should be placed first in linking order
# '_asm' suffix is added to object of assembly file
OBJ += $(addprefix $(BUILD)/obj/, $(SRC_S:.s=_asm.o))
OBJ += $(addprefix $(BUILD)/obj/, $(SRC_C:.c=.o))
CFLAGS += $(CFLAGS_GCC) -MD
# LTO makes it difficult to analyze map file for optimizing size purpose
# We will run this option in ci
ifeq ($(NO_LTO),1)
CFLAGS := $(filter-out -flto,$(CFLAGS))
endif
ifneq ($(CFLAGS_SKIP),)
CFLAGS := $(filter-out $(CFLAGS_SKIP),$(CFLAGS))
endif
LDFLAGS += $(CFLAGS) $(LDFLAGS_GCC)
ifdef LD_FILE
LDFLAGS += -Wl,-T,$(TOP)/$(LD_FILE)
endif
ifdef LD_FILE_GCC
LDFLAGS += -Wl,-T,$(TOP)/$(LD_FILE_GCC)
endif
ifneq ($(SKIP_NANOLIB), 1)
LDFLAGS += --specs=nosys.specs --specs=nano.specs
endif
ASFLAGS += $(CFLAGS)
LIBS_GCC ?= -lgcc -lm -lnosys
# libc
LIBS += $(LIBS_GCC)
ifneq ($(BOARD), spresense)
LIBS += -lc
endif
# ---------------------------------------
# Rules
# ---------------------------------------
# Compile .c file
$(BUILD)/obj/%.o: %.c
@echo CC $(notdir $@)
@$(CC) $(CFLAGS) -c -o $@ $<
# ASM sources lower case .s
$(BUILD)/obj/%_asm.o: %.s
@echo AS $(notdir $@)
@$(AS) $(ASFLAGS) -c -o $@ $<
# ASM sources upper case .S
$(BUILD)/obj/%_asm.o: %.S
@echo AS $(notdir $@)
@$(AS) $(ASFLAGS) -c -o $@ $<
OBJCOPY_BIN_OPTION ?=
$(BUILD)/$(PROJECT).bin: $(BUILD)/$(PROJECT).elf
@echo CREATE $@
$(OBJCOPY) -O binary $(OBJCOPY_BIN_OPTION) $^ $@
$(BUILD)/$(PROJECT).hex: $(BUILD)/$(PROJECT).elf
@echo CREATE $@
@$(OBJCOPY) -O ihex $^ $@
$(BUILD)/$(PROJECT).elf: $(OBJ)
@echo LINK $@
@$(LD) -o $@ $(LDFLAGS) $^ -Wl,--start-group $(LIBS) -Wl,--end-group

View File

@@ -1,11 +0,0 @@
# makefile for arm iar toolchain
AS = iasmarm
LD = ilinkarm
OBJCOPY = ielftool --silent
SIZE = size
# Enable extension mode (gcc compatible)
CFLAGS += -e --debug --silent
# silent mode
ASFLAGS += -S $(addprefix -I,$(INC))

View File

@@ -1,44 +0,0 @@
SRC_S += $(SRC_S_IAR)
# Assembly files can be name with upper case .S, convert it to .s
SRC_S := $(SRC_S:.S=.s)
# Due to GCC LTO bug https://bugs.launchpad.net/gcc-arm-embedded/+bug/1747966
# assembly file should be placed first in linking order
# '_asm' suffix is added to object of assembly file
OBJ += $(addprefix $(BUILD)/obj/, $(SRC_S:.s=_asm.o))
OBJ += $(addprefix $(BUILD)/obj/, $(SRC_C:.c=.o))
# Linker script
LDFLAGS += --config $(TOP)/$(LD_FILE_IAR)
# ---------------------------------------
# Rules
# ---------------------------------------
# Compile .c file
$(BUILD)/obj/%.o: %.c
@echo CC $(notdir $@)
@$(CC) $(CFLAGS) -c -o $@ $<
# ASM sources lower case .s
$(BUILD)/obj/%_asm.o: %.s
@echo AS $(notdir $@)
@$(AS) $(ASFLAGS) -c -o $@ $<
# ASM sources upper case .S
$(BUILD)/obj/%_asm.o: %.S
@echo AS $(notdir $@)
@$(AS) $(ASFLAGS) -c -o $@ $<
$(BUILD)/$(PROJECT).bin: $(BUILD)/$(PROJECT).elf
@echo CREATE $@
@$(OBJCOPY) --bin $^ $@
$(BUILD)/$(PROJECT).hex: $(BUILD)/$(PROJECT).elf
@echo CREATE $@
@$(OBJCOPY) --ihex $^ $@
$(BUILD)/$(PROJECT).elf: $(OBJ)
@echo LINK $@
@$(LD) -o $@ $(LDFLAGS) $^

View File

@@ -1,6 +1,6 @@
import re
version = '0.15.0'
version = '0.16.0'
print('version {}'.format(version))
ver_id = version.split('.')
@@ -9,13 +9,11 @@ ver_id = version.split('.')
# src/tusb_option.h
###################
f_option_h = 'src/tusb_option.h'
with open(f_option_h) as f:
fdata = f.read()
fdata = re.sub(r'(#define TUSB_VERSION_MAJOR *) \d+', r"\1 {}".format(ver_id[0]), fdata)
fdata = re.sub(r'(#define TUSB_VERSION_MINOR *) \d+', r"\1 {}".format(ver_id[1]), fdata)
fdata = re.sub(r'(#define TUSB_VERSION_REVISION *) \d+', r"\1 {}".format(ver_id[2]), fdata)
fdata = re.sub(r'(#define TUSB_VERSION_MAJOR *) \d+', r"\1 {}".format(ver_id[0]), fdata)
fdata = re.sub(r'(#define TUSB_VERSION_MINOR *) \d+', r"\1 {}".format(ver_id[1]), fdata)
fdata = re.sub(r'(#define TUSB_VERSION_REVISION *) \d+', r"\1 {}".format(ver_id[2]), fdata)
# Write the file out again
with open(f_option_h, 'w') as f:
@@ -33,6 +31,17 @@ if fdata.find(version) < 0:
with open(f_repository_yml, 'w') as f:
f.write(fdata)
###################
# library.json
###################
f_library_json = 'library.json'
with open(f_library_json) as f:
fdata = f.read()
fdata = re.sub(r'( {4}"version":) "\d+\.\d+\.\d+"', rf'\1 "{version}"', fdata)
with open(f_library_json, 'w') as f:
f.write(fdata)
###################
# docs/info/changelog.rst
###################