-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #271 from LinjingZhang/xmc1400_can
XMC CAN Sending & Unity starting point
- Loading branch information
Showing
26 changed files
with
5,826 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
.history | ||
.vscode | ||
pkg_build | ||
pkg_build | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
FQBN ?= | ||
PORT ?= | ||
TESTS ?= | ||
|
||
$(info FQBN : $(FQBN)) | ||
$(info PORT : $(PORT)) | ||
|
||
|
||
TESTS_CONNECTED=-DTEST_CAN_CONNECTED | ||
|
||
TESTS_NOT_CONNECTED=-DTEST_CAN | ||
|
||
|
||
CAN_connected: TESTS=-DTEST_CAN -DTEST_CAN_CONNECTED | ||
CAN: TESTS=-DTEST_CAN | ||
|
||
CAN_connected CAN: unity flash | ||
|
||
|
||
# master_baudrate: TESTS=-DMASTER_BAUDRATE | ||
# master_baudrate: PORT=COM18 | ||
|
||
# slave_baudrate: TESTS=-DSLAVE_BAUDRATE | ||
# master_baudrate: PORT=COM17 | ||
|
||
# master_baudrate slave_baudrate: unity flash | ||
|
||
|
||
test_all: TESTS=$(TESTS_CONNECTED) $(TESTS_NOT_CONNECTED) | ||
test_connected: TESTS=$(TESTS_CONNECTED) | ||
test: TESTS=$(TESTS_NOT_CONNECTED) | ||
|
||
test_all \ | ||
test_connected \ | ||
test: unity flash | ||
#test: unity compile | ||
|
||
|
||
EXAMPLES = CANReceiver CANReceiverCallback CANSender | ||
|
||
|
||
clean: | ||
-rm -rf build/* | ||
|
||
|
||
arduino: clean | ||
mkdir -p build | ||
# copy library file | ||
# cp -r libraries/CAN/* build | ||
# find src -name '*.[hc]*' -a \( \! -name 'main*' \) -print -exec cp {} build \; | ||
|
||
|
||
CANReceiver: arduino | ||
cp examples/CANReceiver/CANReceiver.ino build/build.ino | ||
|
||
CANReceiverCallback: arduino | ||
cp examples/CANReceiverCallback/CANReceiverCallback.ino build/build.ino | ||
|
||
CANSender: arduino | ||
cp examples/CANSender/CANSender.ino build/build.ino | ||
|
||
# master1: | ||
# ... | ||
|
||
# slave1: | ||
# ... | ||
|
||
|
||
unity: arduino | ||
cp -r test/unit/Unity/*.[hc] build | ||
cp test/unit/src/framework/arduino/Test_*.[hc]* build | ||
cp test/unit/src/framework/arduino/unity_ifx.cpp build | ||
cp test/unit/src/framework/arduino/Test_main.ino build/build.ino | ||
|
||
|
||
# For WSL and Windows : | ||
# download arduino-cli.exe from : https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Windows_64bit.zip | ||
compile: | ||
ifeq ($(FQBN),) | ||
$(error "Must set variable FQBN in order to be able to compile Arduino sketches !") | ||
else | ||
# CAUTION : only use '=' when assigning values to vars, not '+=' | ||
arduino-cli.exe compile --clean --log --warnings all --fqbn $(FQBN) --build-property "compiler.c.extra_flags=\"-DUNITY_INCLUDE_CONFIG_H=1\"" \ | ||
--build-property compiler.cpp.extra_flags="$(TESTS)" \ | ||
--build-property compiler.ar.cmd=arm-none-eabi-gcc-ar \ | ||
--build-property compiler.libraries.ldflags=-lstdc++ \ | ||
--build-property compiler.arm.cmsis.path="-isystem{compiler.xmclib_include.path}/XMCLib_CAN_v4_3_0/inc -isystem{compiler.xmclib_include.path}/XMCLib/inc -isystem{compiler.dsp_include.path} -isystem{compiler.nn_include.path} -isystem{compiler.cmsis_include.path} -isystem{compiler.xmclib_include.path}/LIBS -isystem{build.variant.path} -isystem{build.variant.config_path}" \ | ||
--build-property compiler.usb.path="-isystem{runtime.platform.path}/cores/usblib -isystem{runtime.platform.path}/cores/usblib/Common -isystem{runtime.platform.path}/cores/usblib/Class -isystem{runtime.platform.path}/cores/usblib/Class/Common -isystem{runtime.platform.path}/cores/usblib/Class/Device -isystem{runtime.platform.path}/cores/usblib/Core -isystem{runtime.platform.path}/cores/usblib/Core/XMC4000" \ | ||
build | ||
endif | ||
|
||
|
||
upload: | ||
ifeq ($(PORT),) | ||
$(error "Must set variable PORT (Windows port naming convention, ie COM16) in order to be able to flash Arduino sketches !") | ||
endif | ||
ifeq ($(FQBN),) | ||
$(error "Must set variable FQBN in order to be able to flash Arduino sketches !") | ||
else | ||
arduino-cli.exe upload -p $(PORT) --fqbn $(FQBN) build | ||
endif | ||
|
||
|
||
flash: compile upload | ||
|
||
|
||
monitor: | ||
ifeq ($(PORT),) | ||
$(error "Must set variable PORT (Windows port naming convention, ie COM16) in order to be able to flash Arduino sketches !") | ||
endif | ||
ifeq ($(FQBN),) | ||
$(error "Must set variable FQBN in order to be able to flash Arduino sketches !") | ||
else | ||
arduino-cli.exe monitor -c baudrate=9600 -p $(PORT) --fqbn $(FQBN) | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
### Build commands | ||
|
||
|
||
### Example program | ||
make FQBN=Infineon:xmc:XMC4700_Relax_Kit PORT=COM20 CANReceiver flash monitor | ||
|
||
make FQBN=Infineon:xmc:XMC4700_Relax_Kit PORT=COM20 CANReceiverCallback flash monitor | ||
|
||
make FQBN=Infineon:xmc:XMC4700_Relax_Kit PORT=COM24 CANSender flash monitor | ||
|
||
|
||
|
||
### Unit tests | ||
make FQBN=Infineon:xmc:XMC4700_Relax_Kit PORT=COM20 CAN monitor | ||
|
||
make FQBN=Infineon:xmc:XMC1100_XMC2GO PORT=COM21 CAN_connected monitor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef CAN_H | ||
#define CAN_H | ||
|
||
#if defined(CAN_xmc) | ||
#include "CANXMC.h" | ||
#endif | ||
|
||
#endif |
Oops, something went wrong.