Skip to content

Commit 055722b

Browse files
committed
Add lib-superloop and integrate into build
Introduce a new lib-superloop library (Eclipse project files, Makefiles, Rules.mk, and settings) and add it to the firmware build list. Move superloop software timer sources/headers from lib-hal to lib-superloop, update file headers (copyright year), rename the timer callback parameter in the header, and fix a stray character in the error message. Update GD32 Includes.mk to prefer FreeRTOS includes when USE_FREE_RTOS is set and otherwise add lib-superloop include path. Also add small formatting/namespace cleanup in lib-flashcode/include/flashcode.h and add lib-superloop to firmware-template/libs.mk.
1 parent 510698f commit 055722b

12 files changed

Lines changed: 225 additions & 14 deletions

File tree

common/make/gd32/Includes.mk

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ INCLUDES+=-I../lib-gd32/${FAMILY}/${FAMILY_UC}_standard_peripheral/Include
88
INCLUDES+=-I../lib-gd32/${FAMILY}/CMSIS/GD/${FAMILY_UC}/Include
99
INCLUDES+=-I../lib-gd32/include
1010
INCLUDES+=-I../lib-hwclock/include
11+
1112
INCLUDES+=$(addprefix -I,$(EXTRA_INCLUDES))
1213

1314
ALL_FLAGS := $(DEFINES) $(MAKE_FLAGS)
@@ -16,12 +17,19 @@ $(info $$ALL_FLAGS [${ALL_FLAGS}])
1617
# $(call set_if_present,FLAG,VAR) -> sets VAR=1 if FLAG or -DFLAG is present
1718
set_if_present = $(eval $(2) := $(if $(filter $(1) -D$(1),$(ALL_FLAGS)),1,))
1819

20+
$(call set_if_present,USE_FREE_RTOS, FREE_RTOS)
1921
$(call set_if_present,ENABLE_USB_HOST,USB_HOST)
2022
$(call set_if_present,CONFIG_USB_HOST_MSC,USB_HOST_MSC)
2123
$(call set_if_present,ENABLE_USB_DEVICE,USB_DEVICE)
2224
$(call set_if_present,CONFIG_USB_DEVICE_CDC,USB_DEVICE_CDC)
2325
$(call set_if_present,CONFIG_USB_DEVICE_HID,USB_DEVICE_HID)
2426

27+
ifdef FREE_RTOS
28+
INCLUDES+=-I../FreeRTOS/FreeRTOS-Kernel/include
29+
else
30+
INCLUDES+=-I../lib-superloop/include
31+
endif
32+
2533
ifdef USB_HOST
2634
INCLUDES+=-I../lib-gd32/device/usb
2735
INCLUDES+=-I../lib-hal/device/usb/host/gd32

firmware-template/libs.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ ifeq ($(findstring DISPLAY_UDF,$(DEFINES)),DISPLAY_UDF)
2929
LIBS+=displayudf
3030
endif
3131

32-
LIBS+=configstore flashcode display hal hwclock
32+
LIBS+=configstore flashcode display superloop hal hwclock
3333

3434
$(info $$LIBS [${LIBS}])

lib-flashcode/include/flashcode.h

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,11 @@
2828

2929
#include <cstdint>
3030

31-
namespace flashcode
32-
{
33-
enum class Result
34-
{
35-
kOk,
36-
kError
37-
};
31+
namespace flashcode {
32+
enum class Result { kOk, kError };
3833
} // namespace flashcode
3934

40-
class FlashCode
41-
{
35+
class FlashCode {
4236
public:
4337
FlashCode();
4438
~FlashCode();
@@ -60,4 +54,4 @@ class FlashCode
6054
inline static FlashCode* s_this;
6155
};
6256

63-
#endif // FLASHCODE_H_
57+
#endif // FLASHCODE_H_

lib-superloop/.clangd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CompileFlags: {CompilationDatabase: }

lib-superloop/.cproject

Lines changed: 153 additions & 0 deletions
Large diffs are not rendered by default.

lib-superloop/.project

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>lib-superloop</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
10+
<triggers>clean,full,incremental,</triggers>
11+
<arguments>
12+
</arguments>
13+
</buildCommand>
14+
<buildCommand>
15+
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
16+
<triggers>full,incremental,</triggers>
17+
<arguments>
18+
</arguments>
19+
</buildCommand>
20+
</buildSpec>
21+
<natures>
22+
<nature>org.eclipse.cdt.core.cnature</nature>
23+
<nature>org.eclipse.cdt.core.ccnature</nature>
24+
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
25+
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
26+
</natures>
27+
</projectDescription>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<project>
3+
<configuration id="ilg.gnuarmeclipse.managedbuild.cross.toolchain.base.1400393409" name="Default">
4+
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
5+
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
6+
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
7+
<provider copy-of="extension" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser"/>
8+
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="234589836992184224" id="org.eclipse.embedcdt.managedbuild.cross.arm.core.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT Arm Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
9+
<language-scope id="org.eclipse.cdt.core.gcc"/>
10+
<language-scope id="org.eclipse.cdt.core.g++"/>
11+
</provider>
12+
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
13+
</extension>
14+
</configuration>
15+
</project>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
eclipse.preferences.version=1
2+
encoding/<project>=UTF-8

lib-superloop/Makefile.GD32

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
DEFINES=NDEBUG
2+
3+
EXTRA_INCLUDES=
4+
EXTRA_SRCDIR=
5+
6+
include Rules.mk
7+
include ../firmware-template-gd32/lib/Rules.mk

lib-superloop/Rules.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
$(info $$MAKE_FLAGS [${MAKE_FLAGS}])
2+
3+
EXTRA_INCLUDES+=
4+
EXTRA_SRCDIR+=

0 commit comments

Comments
 (0)