Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
62d9f530
Verified
Commit
62d9f530
authored
5 years ago
by
rahix
Browse files
Options
Downloads
Patches
Plain Diff
WIP: Add sdk to Makefile
parent
70bf9d4b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
ports/card10/Makefile
+83
-8
83 additions, 8 deletions
ports/card10/Makefile
with
83 additions
and
8 deletions
ports/card10/Makefile
+
83
−
8
View file @
62d9f530
...
...
@@ -8,20 +8,35 @@ include $(TOP)/py/py.mk
CROSS_COMPILE
=
arm-none-eabi-
SDK_LOCATION
?=
../../../firmware/sdk
INC
+=
-I
.
INC
+=
-I
$(
TOP
)
INC
+=
-I
$(
BUILD
)
INC
+=
-I
$(
SDK_LOCATION
)
/Libraries/MAX32665PeriphDriver/Include
INC
+=
-I
$(
SDK_LOCATION
)
/Libraries/CMSIS/Device/Maxim/MAX32665/Include
INC
+=
-I
$(
SDK_LOCATION
)
/Libraries/CMSIS/Include
INC
+=
-I
$(
SDK_LOCATION
)
/Libraries/Boards/card10/Include
INC
+=
-I
$(
SDK_LOCATION
)
/Libraries/Boards/Include
# CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mabi=aapcs-linux -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion
# CFLAGS = $(INC) -Wall -Werror -std=c99 -nostdlib $(CFLAGS_CORTEX_M4) $(COPT)
# LDFLAGS = -nostdlib -T stm32f405.ld -Map=$@.map --cref --gc-sections
CFLAGS_MAX32665
=
-mthumb
-mcpu
=
cortex-m4
-mfloat-abi
=
softfp
-mfpu
=
fpv4-sp-d16
SDK_CFLAGS
=
-DTARGET
=
32665
-DTARGET_REV
=
0x4131
-DBOARD_CARD10
=
1
-Wa
,-mimplicit-it
=
thumb
CFLAGS
=
$(
CFLAGS_MAX32665
)
-Wall
-Wdouble-promotion
-Wno-format
-fno-isolate-erroneous-paths-dereference
-fsingle-precision-constant
-std
=
c99
$(
SDK_CFLAGS
)
$(
INC
)
CFLAGS_CORTEX_M4
=
-mthumb
-mtune
=
cortex-m4
-mabi
=
aapcs-linux
-mcpu
=
cortex-m4
-mfpu
=
fpv4-sp-d16
-mfloat-abi
=
hard
-fsingle-precision-constant
-Wdouble-promotion
CFLAGS
=
$(
INC
)
-Wall
-Werror
-std
=
c99
-nostdlib
$(
CFLAGS_CORTEX_M4
)
$(
COPT
)
LDFLAGS
=
-nostdlib
-T
stm32f405.ld
-Map
=
$@
.map
--cref
--gc-sections
LDFLAGS
=
-T
$(
SDK_LOCATION
)
/Libraries/CMSIS/Device/Maxim/MAX32665/Source/GCC/max32665.ld
LDFLAGS
+=
--entry
Reset_Handler
$(
CFLAGS_MAX32665
)
LDFLAGS
+=
-Xlinker
--gc-sections
-Xlinker
-Map
-Xlinker
$(
BUILD
)
/max32665.map
LDFLAGS
+=
-L
$(
SDK_LOCATION
)
/Libraries/CMSIS/Device/Maxim/MAX32665/Source/GCC
# Tune for Debugging or Optimization
ifeq
($(DEBUG), 1)
CFLAGS
+=
-O0
-ggdb
CFLAGS
+=
-O0
-ggdb
-DDEBUG
-DMXC_ASSERT_ENABLE
else
CFLAGS
+=
-Os
-DNDEBUG
CFLAGS
+=
-fdata-sections
-ffunction-sections
CFLAGS
+=
-fdata-sections
-ffunction-sections
-fsingle-precision-constant
endif
LIBS
=
...
...
@@ -37,11 +52,71 @@ SRC_C = \
OBJ
=
$(
PY_CORE_O
)
$(
addprefix
$(
BUILD
)
/,
$(
SRC_C:.c
=
.o
))
all
:
$(BUILD)/firmware.elf
# SDK compilation hack
# -----------------------------------------------------------------------------
.PHONY
:
sdk
sdk
:
$(BUILD)/sdk/PeriphDriver.a
# Rules to build sdk sources
SDK_SOURCES
=
$(
wildcard
$(
SDK_LOCATION
)
/Libraries/MAX32665PeriphDriver/Source/
*
.c
)
SDK_OBJECTS
=
$(
foreach src,
$(
SDK_SOURCES
)
,
\
$(
patsubst
$(
SDK_LOCATION
)
/Libraries/MAX32665PeriphDriver/Source/%.c,
$(
BUILD
)
/sdk/%.o,
$(
src
))
\
)
$(BUILD)/sdk
:
@
mkdir
-p
$(
BUILD
)
/sdk
$(BUILD)/sdk/PeriphDriver.a
:
$(BUILD)/sdk $(SDK_OBJECTS)
$(
ECHO
)
"AR
$@
"
$(
Q
)$(
CROSS_COMPILE
)
ar
-cr
$@
$(
SDK_OBJECTS
)
$(BUILD)/sdk/%.o
:
$(SDK_LOCATION)/Libraries/MAX32665PeriphDriver/Source/%.c
$(
ECHO
)
"CC
$<
"
$(
Q
)$(
CC
)
$(
CFLAGS
)
-c
-MD
-o
$@
$<
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Rules to build board.c and startup files
SDK_BOARD_SRC
=
$(
wildcard
$(
SDK_LOCATION
)
/Libraries/Boards/Source/
*
.c
)
SDK_BOARD_OBJ
=
$(
foreach src,
$(
SDK_BOARD_SRC
)
,
\
$(
patsubst
$(
SDK_LOCATION
)
/Libraries/Boards/Source/%.c,
$(
BUILD
)
/sdk/board/%.o,
$(
src
))
\
)
BOARD_ADDITIONAL
=
board.o startup_max32665.o heap.o system_max32665.o
SDK_BOARD_OBJ
+=
$(
foreach obj,
$(
BOARD_ADDITIONAL
)
,
$(
BUILD
)
/sdk/board/
$(
obj
))
.PHONY
:
board
board
:
$(BUILD)/sdk/board $(SDK_BOARD_OBJ)
$(BUILD)/sdk/board
:
@
mkdir
-p
$(
BUILD
)
/sdk/board
$(BUILD)/sdk/board/board.o
:
$(SDK_LOCATION)/Libraries/Boards/card10/Source/board.c
$(
ECHO
)
"CC
$<
"
$(
Q
)$(
CC
)
$(
CFLAGS
)
-c
-MD
-o
$@
$<
$(BUILD)/sdk/board/startup_max32665.o
:
$(SDK_LOCATION)/Libraries/CMSIS/Device/Maxim/MAX32665/Source/GCC/startup_max32665.S
$(
ECHO
)
"CC
$<
"
$(
Q
)$(
CC
)
$(
CFLAGS
)
-c
-MD
-o
$@
$<
$(BUILD)/sdk/board/heap.o
:
$(SDK_LOCATION)/Libraries/CMSIS/Device/Maxim/MAX32665/Source/heap.c
$(
ECHO
)
"CC
$<
"
$(
Q
)$(
CC
)
$(
CFLAGS
)
-c
-MD
-o
$@
$<
$(BUILD)/sdk/board/system_max32665.o
:
$(SDK_LOCATION)/Libraries/CMSIS/Device/Maxim/MAX32665/Source/system_max32665.c
$(
ECHO
)
"CC
$<
"
$(
Q
)$(
CC
)
$(
CFLAGS
)
-c
-MD
-o
$@
$<
$(BUILD)/sdk/board/%.o
:
$(SDK_LOCATION)/Libraries/Boards/Source/%.c
$(
ECHO
)
"CC
$<
"
$(
Q
)$(
CC
)
$(
CFLAGS
)
-c
-MD
-o
$@
$<
# -----------------------------------------------------------------------------
all
:
sdk board $(BUILD)/firmware.elf
$(BUILD)/firmware.elf
:
$(OBJ)
$(BUILD)/firmware.elf
:
$(OBJ)
$(SDK_BOARD_OBJ)
$(
ECHO
)
"LINK
$@
"
$(
Q
)$(
LD
)
$(
LDFLAGS
)
-o
$@
$^
$(
LIBS
)
$(
Q
)$(
CC
)
$(
LDFLAGS
)
-o
$@
$^
$(
LIBS
)
-Xlinker
--start-group
$(
BUILD
)
/sdk/PeriphDriver.a
-lc
-lm
-lnosys
-Xlinker
--end-group
$(
Q
)$(
SIZE
)
$@
# $(BUILD)/firmware.bin: $(BUILD)/firmware.elf
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment