[core] Use external FreeRTOS library
This commit is contained in:
@@ -269,6 +269,16 @@ queue.AddLibrary(
|
||||
)
|
||||
|
||||
# Sources - FreeRTOS
|
||||
freertos_opts = dict(
|
||||
CCFLAGS=[
|
||||
# build FreeRTOS port in ARM mode
|
||||
"+<-marm>",
|
||||
"-<-mthumb>",
|
||||
],
|
||||
)
|
||||
env.Replace(FREERTOS_PORT="beken-bdk", FREERTOS_PORT_DEFINE="BEKEN_BDK")
|
||||
queue.AddExternalLibrary("freertos", options=freertos_opts)
|
||||
queue.AddExternalLibrary("freertos-port", options=freertos_opts)
|
||||
queue.AddLibrary(
|
||||
name="bdk_freertos_thumb",
|
||||
base_dir=ROOT_DIR,
|
||||
@@ -279,24 +289,6 @@ queue.AddLibrary(
|
||||
"+<os/*>",
|
||||
],
|
||||
)
|
||||
queue.AddLibrary(
|
||||
name="bdk_freertos_arm",
|
||||
base_dir="$SDK_DIR",
|
||||
srcs=[
|
||||
"+<FreeRTOSv9.0.0/FreeRTOS/Source/**/*.c>",
|
||||
],
|
||||
includes=[
|
||||
"+<FreeRTOSv9.0.0/FreeRTOS/Source/include>",
|
||||
"+<FreeRTOSv9.0.0/FreeRTOS/Source/portable/Keil/ARM968es>",
|
||||
],
|
||||
options=dict(
|
||||
CCFLAGS=[
|
||||
# build FreeRTOS port in ARM mode
|
||||
"+<-marm>",
|
||||
"-<-mthumb>",
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
# Sources - lwIP
|
||||
queue.AddExternalLibrary("lwip", port="bdk")
|
||||
|
||||
@@ -96,17 +96,8 @@ queue.AddLibrary(
|
||||
"+<component/common/drivers/wlan/realtek/src/osdep/lwip_intf.c>",
|
||||
"+<component/common/network/dhcp/dhcps.c>",
|
||||
"+<component/common/network/ssl/ssl_ram_map/ssl_ram_map.c>",
|
||||
"+<component/os/freertos/freertos_v8.1.2/Source/portable/MemMang/heap_5.c>",
|
||||
"+<component/os/freertos/freertos_v8.1.2/Source/portable/GCC/ARM_CM4F/port.c>",
|
||||
# "+<component/os/freertos/freertos_v8.1.2/Source/portable/IAR/ARM_CM4F/portasm.s>",
|
||||
"+<component/os/freertos/cmsis_os.c>",
|
||||
"+<component/os/freertos/freertos_v8.1.2/Source/croutine.c>",
|
||||
"+<component/os/freertos/freertos_v8.1.2/Source/event_groups.c>",
|
||||
"+<component/os/freertos/freertos_service.c>",
|
||||
"+<component/os/freertos/freertos_v8.1.2/Source/list.c>",
|
||||
"+<component/os/freertos/freertos_v8.1.2/Source/queue.c>",
|
||||
"+<component/os/freertos/freertos_v8.1.2/Source/tasks.c>",
|
||||
"+<component/os/freertos/freertos_v8.1.2/Source/timers.c>",
|
||||
"+<component/os/os_dep/device_lock.c>",
|
||||
"+<component/os/os_dep/osdep_service.c>",
|
||||
"+<component/common/mbed/targets/hal/rtl8711b/analogin_api.c>",
|
||||
@@ -144,8 +135,6 @@ queue.AddLibrary(
|
||||
includes=[
|
||||
"+<project/realtek_amebaz_va0_example/inc>",
|
||||
"+<component/os/freertos>",
|
||||
"+<component/os/freertos/freertos_v8.1.2/Source/include>",
|
||||
"+<component/os/freertos/freertos_v8.1.2/Source/portable/GCC/ARM_CM4F>",
|
||||
"+<component/os/os_dep/include>",
|
||||
"+<component/common/api/network/include>",
|
||||
"+<component/common/api>",
|
||||
@@ -191,6 +180,11 @@ queue.AddLibrary(
|
||||
),
|
||||
)
|
||||
|
||||
# Sources - FreeRTOS
|
||||
env.Replace(FREERTOS_PORT=env["FAMILY_NAME"], FREERTOS_PORT_DEFINE="REALTEK_AMB1")
|
||||
queue.AddExternalLibrary("freertos")
|
||||
queue.AddExternalLibrary("freertos-port")
|
||||
|
||||
# Sources - lwIP
|
||||
queue.AddExternalLibrary("lwip", port="amb1")
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ if not found:
|
||||
exit(1)
|
||||
|
||||
# Sources - ArduinoCore-API
|
||||
queue.AddExternalLibrary("arduino_api")
|
||||
queue.AddExternalLibrary("arduino-api")
|
||||
|
||||
# Sources - board variant
|
||||
queue.AddLibrary(
|
||||
|
||||
@@ -97,7 +97,7 @@ queue.AppendPublic(
|
||||
CXXFLAGS=[
|
||||
"-Wno-literal-suffix",
|
||||
"-Wno-write-strings",
|
||||
"-Wno-psabi",
|
||||
"-Wno-psabi", # parameter passing for argument of type ... changed in GCC 7.1
|
||||
],
|
||||
CPPDEFINES=[
|
||||
("LIBRETUYA", 1),
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
from dataclasses import dataclass
|
||||
from typing import Dict, List, Optional, Union
|
||||
|
||||
from ltchiptool.util.dict import merge_dicts
|
||||
from platformio.package.meta import PackageItem
|
||||
from platformio.platform.base import PlatformBase
|
||||
from SCons.Script import DefaultEnvironment, Environment
|
||||
@@ -31,6 +32,7 @@ def env_add_external_library(
|
||||
queue,
|
||||
name: str,
|
||||
port: Optional[str] = None,
|
||||
options: Dict[str, List[str]] = {},
|
||||
):
|
||||
if port:
|
||||
name += f"-{port}"
|
||||
@@ -46,16 +48,19 @@ def env_add_external_library(
|
||||
f"Version '{version}' of library '{name}' ({lib.package}) is not installed"
|
||||
)
|
||||
|
||||
opts_default = dict(
|
||||
CFLAGS=lib.flags,
|
||||
CPPDEFINES=[(k, v) for k, v in lib.defines.items()],
|
||||
LINKFLAGS=lib.linkflags,
|
||||
)
|
||||
options = merge_dicts(opts_default, options)
|
||||
|
||||
queue.AddLibrary(
|
||||
name=name.replace("-", "_"),
|
||||
base_dir=package.path,
|
||||
srcs=lib.sources,
|
||||
includes=lib.includes,
|
||||
options=dict(
|
||||
CFLAGS=lib.flags,
|
||||
CPPDEFINES=[(k, v) for k, v in lib.defines.items()],
|
||||
LINKFLAGS=lib.linkflags,
|
||||
),
|
||||
options=options,
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import fnmatch
|
||||
from dataclasses import InitVar, dataclass, field
|
||||
from glob import glob
|
||||
from os.path import isdir, join
|
||||
from typing import Dict, Generator, List, Optional, Tuple
|
||||
from typing import Dict, Generator, List, Tuple
|
||||
|
||||
from ltchiptool.util.dict import merge_dicts
|
||||
from SCons.Script import DefaultEnvironment, Environment
|
||||
@@ -127,8 +127,8 @@ class LibraryQueue:
|
||||
self.options_public = merge_dicts(self.options_public, {key: option})
|
||||
self.queue.append(lib)
|
||||
|
||||
def AddExternalLibrary(self, name: str, port: Optional[str] = None):
|
||||
return self.env.AddExternalLibrary(self, name, port)
|
||||
def AddExternalLibrary(self, *args, **kwargs):
|
||||
return self.env.AddExternalLibrary(self, *args, **kwargs)
|
||||
|
||||
def AppendPublic(self, **kwargs):
|
||||
if "CPPPATH" in kwargs:
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
"+<.>"
|
||||
]
|
||||
},
|
||||
"arduino_api": {
|
||||
"arduino-api": {
|
||||
"package": "framework-arduino-api",
|
||||
"sources": [
|
||||
"+<api/Common.cpp>",
|
||||
@@ -60,6 +60,27 @@
|
||||
"+<api/deprecated>"
|
||||
]
|
||||
},
|
||||
"freertos": {
|
||||
"package": "library-freertos",
|
||||
"sources": [
|
||||
"+<FreeRTOS/Source/*.c>"
|
||||
],
|
||||
"includes": [
|
||||
"+<FreeRTOS/Source/include>"
|
||||
]
|
||||
},
|
||||
"freertos-port": {
|
||||
"package": "library-freertos-port",
|
||||
"sources": [
|
||||
"+<./$FREERTOS_PORT/*.c>"
|
||||
],
|
||||
"includes": [
|
||||
"+<./$FREERTOS_PORT>"
|
||||
],
|
||||
"defines": {
|
||||
"FREERTOS_PORT_${FREERTOS_PORT_DEFINE}": "1"
|
||||
}
|
||||
},
|
||||
"lwip-amb1": {
|
||||
"package": "library-lwip",
|
||||
"sources": [
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"pattern": "^[!+-]<[\\w/*.]+>$"
|
||||
"pattern": "^[!+-]<[$\\w/*.]+>$"
|
||||
}
|
||||
},
|
||||
"includes": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"pattern": "^[!+-]<[\\w/*.]+>$"
|
||||
"pattern": "^[!+-]<[$\\w/*.]+>$"
|
||||
}
|
||||
},
|
||||
"flags": {
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
"any": "gccarmnoneeabi@~1.100301.0"
|
||||
},
|
||||
"libraries": {
|
||||
"freertos": "8.1.2",
|
||||
"lwip": {
|
||||
"1.4.1": "1.4.1-amb1",
|
||||
"2.0.0": "2.0.0-amb1",
|
||||
@@ -53,6 +54,7 @@
|
||||
"any":"gccarmnoneeabi@~1.100301.0"
|
||||
},
|
||||
"libraries": {
|
||||
"freertos": "9.0.0",
|
||||
"lwip": {
|
||||
"2.0.2": "2.0.2-bdk",
|
||||
"2.1.0": "2.1.0-bdk",
|
||||
@@ -72,6 +74,15 @@
|
||||
"base_url": "https://github.com/libretuya/lwip",
|
||||
"version_prefix": true
|
||||
},
|
||||
"library-freertos": {
|
||||
"type": "framework",
|
||||
"optional": true,
|
||||
"base_url": "https://github.com/libretuya/library-freertos"
|
||||
},
|
||||
"library-freertos-port": {
|
||||
"type": "framework",
|
||||
"version": "https://github.com/libretuya/library-freertos-port#2023.03.13"
|
||||
},
|
||||
"library-flashdb": {
|
||||
"type": "framework",
|
||||
"version": "https://github.com/libretuya/library-flashdb#1.2.0"
|
||||
|
||||
10
platform.py
10
platform.py
@@ -188,13 +188,21 @@ class LibretuyaPlatform(PlatformBase):
|
||||
continue
|
||||
for name, lib_versions in package["libraries"].items():
|
||||
package = f"library-{name}"
|
||||
if isinstance(lib_versions, str):
|
||||
# single version specified as string
|
||||
if name in versions:
|
||||
pkg_versions[package] = versions[name]
|
||||
else:
|
||||
pkg_versions[package] = lib_versions
|
||||
continue
|
||||
# mapping of versions to repo branches
|
||||
if name in versions and versions[name] in lib_versions:
|
||||
pkg_versions[package] = lib_versions[versions[name]]
|
||||
continue
|
||||
if "default" in lib_versions:
|
||||
pkg_versions[package] = lib_versions["default"]
|
||||
|
||||
# gather custom versions of other libraries
|
||||
# gather custom (user-set) versions of other libraries
|
||||
for name, version in versions.items():
|
||||
if name == "toolchain":
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user