Skip to content

Commit

Permalink
Merge pull request #292 from Infineon/feature/can_bus
Browse files Browse the repository at this point in the history
Feature/CAN_XMC14002GO
  • Loading branch information
LinjingZhang authored Aug 20, 2024
2 parents bed41f4 + 38598e9 commit 0c59b41
Show file tree
Hide file tree
Showing 166 changed files with 18,370 additions and 14,137 deletions.
8 changes: 6 additions & 2 deletions .github/scripts/release.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import argparse, copy, hashlib, json, re, requests, os, shutil

version = '0.2.0'
version = '0.2.1'

xmc_ino_root_path = os.path.relpath(os.path.join(os.path.join(os.getcwd(), os.pardir), os.pardir))
build_dir_name = 'pkg_build'
Expand Down Expand Up @@ -37,8 +37,12 @@ def build_package(pkg_name):
'README.md'
]

ignore_pattern = shutil.ignore_patterns()

for dir in dirs_to_copy:
shutil.copytree(os.path.join(xmc_ino_root_path, dir), os.path.join(pkg_build_path, dir))
if dir == 'libraries':
ignore_pattern = shutil.ignore_patterns('Makefile', 'Makefile.test', 'test')
shutil.copytree(os.path.join(xmc_ino_root_path, dir), os.path.join(pkg_build_path, dir), ignore=ignore_pattern)

for file in files_to_copy:
shutil.copyfile(os.path.join(xmc_ino_root_path, file), os.path.join(pkg_build_path, file))
Expand Down
21 changes: 17 additions & 4 deletions .github/workflows/compile-platform-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
stackMem: true
dma: false
alarmRtc: false
can: false
- fqbn: Infineon:xmc:XMC1100_XMC2GO
i2s: true
dieTemp: true
Expand All @@ -53,6 +54,7 @@ jobs:
stackMem: true
dma: false
alarmRtc: false
can: false
- fqbn: Infineon:xmc:XMC1300_Boot_Kit
i2s: false
dieTemp: true
Expand All @@ -63,6 +65,7 @@ jobs:
multiSerial: false
dma: false
alarmRtc: false
can: false
- fqbn: Infineon:xmc:XMC4200_Platform2GO
i2s: false
dieTemp: false
Expand All @@ -73,6 +76,7 @@ jobs:
multiSerial: false
dma: false
alarmRtc: true
can: true
- fqbn: Infineon:xmc:XMC4400_Platform2GO
i2s: false
dieTemp: false
Expand All @@ -82,6 +86,7 @@ jobs:
stackMem: true
dma: false
alarmRtc: false
can: true
- fqbn: Infineon:xmc:XMC4700_Relax_Kit
i2s: true
dieTemp: true
Expand All @@ -92,6 +97,7 @@ jobs:
multiSerial: true
dma: true
alarmRtc: true
can: true
- fqbn: Infineon:xmc:XMC1400_XMC2GO
i2s: true
dieTemp: true
Expand All @@ -101,6 +107,7 @@ jobs:
stackMem: false
dma: false
alarmRtc: false
can: true
- fqbn: Infineon:xmc:XMC1400_Arduino_Kit
i2s: false
dieTemp: true
Expand All @@ -111,6 +118,7 @@ jobs:
multiSerial: false
dma: false
alarmRtc: false
can: false

# Make board type-specific customizations to the matrix jobs
include:
Expand Down Expand Up @@ -146,12 +154,16 @@ jobs:
alarmRtc: true
alarmRtc-sketch-paths: |
- libraries/RTC/examples/AlarmRTC
- board:
can: true
can-sketch-paths: |
- libraries/CAN/examples
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Compile examples
uses: arduino/compile-sketches@v1
uses: arduino/compile-sketches@v1.1.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
fqbn: ${{ matrix.board.fqbn }}
Expand All @@ -178,12 +190,13 @@ jobs:
${{ matrix.multiSerial-sketch-paths }}
${{ matrix.dma-sketch-paths }}
${{ matrix.alarmRtc-sketch-paths }}
${{ matrix.can-sketch-paths }}
enable-deltas-report: false
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}

- name: Save sketches report as workflow artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
path: ${{ env.SKETCHES_REPORTS_PATH }}
name: ${{ env.SKETCHES_REPORTS_PATH }}
name: ${{ env.SKETCHES_REPORTS_PATH }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.history
.vscode
pkg_build
pkg_build
build
.clang-format
**/__pycache__/
16 changes: 16 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,22 @@ Check the **develop** branch for any Beta releases fixes for any issues you may
4. Other branches are for other tests and not to be treated as anything but work in progress for now
5. Check [XMC-for-Arduino Wiki](https://github.com/Infineon/XMC-for-Arduino/wiki) for any additional information

### Develop Built-in Library
<ul>
<li>Reference to other libraries in the libraris folder. Typically required files include: </li>
<ul>
<li>source</li>
<li>library.properties</li>
<li>keywords.txt</li>
<li>README.md</li>
</ul>
<li>Check out the official arduino libraries and try to keep the API consistent</li>
<li>Add Compilation test in github workflow</li>
<li>Update documentation ( README, github wiki...)</li>
</ul>

### Add new XMC Board

### Local Running using Arduino IDE (**ON WINDOWS**):
Clone the repository in arduino folder:
- Open Arduino and install any Infineon XMC library (e.g. 2.2.0)
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ This repository integrates [Infineon's](https://www.infineon.com/) XMC microcont
* [XMC1100 2Go](https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc_2go_xmc1100_v1/)
* [XMC1100 Boot Kit](https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc11_boot_001/)
* [XMC1300 Boot Kit](https://www.infineon.com/cms/de/product/evaluation-boards/kit_xmc13_boot_001/)
* [XMC1400 2Go](https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc14_2go/)
* [XMC1400 Kit for Arduino](https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc1400_arduino/)
* [XMC4200 Platform 2Go](https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc_plt2go_xmc4200/)
* [XMC4400 Platform 2Go](https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc_plt2go_xmc4400//)
Expand All @@ -35,6 +36,7 @@ Please visit also the Wiki for additional information, e.g. datasheets, pin out
* Page for [XMC1100 XMC 2Go](https://github.com/Infineon/XMC-for-Arduino/wiki/XMC-2Go)
* Page for [XMC1100 Boot Kit](https://github.com/Infineon/XMC-for-Arduino/wiki/XMC1100-Boot-Kit)
* Page for [XMC1300 Boot Kit](https://github.com/Infineon/XMC-for-Arduino/wiki/XMC1300-Boot-Kit)
* Page for [XMC1400 2Go](https://www.infineon.com/cms/en/product/evaluation-boards/kit_xmc14_2go/)
* Page for [XMC1400 Kit for Arduino](https://github.com/Infineon/XMC-for-Arduino/wiki/XMC1400-Kit-for-Arduino)
* Page for [XMC4200 Platform 2Go](https://github.com/Infineon/XMC-for-Arduino/wiki/XMC4200-Platform2Go)
* Page for [XMC4400 Platform 2Go](https://github.com/Infineon/XMC-for-Arduino/wiki/XMC4400-Platform2Go)
Expand Down
2 changes: 1 addition & 1 deletion boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ XMC1400_XMC2GO.serial.disableRTS=true
XMC1400_XMC2GO.build.mcu=cortex-m0
XMC1400_XMC2GO.build.f_cpu=48000000L
XMC1400_XMC2GO.build.board=ARM_XMC
XMC1400_XMC2GO.build.board.version=1402
XMC1400_XMC2GO.build.board.version=1404
XMC1400_XMC2GO.build.board.type=Q040x0200
XMC1400_XMC2GO.build.board.v=0200
XMC1400_XMC2GO.build.core=./
Expand Down
41 changes: 38 additions & 3 deletions cores/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ extern "C" {
#include <xmc_spi.h>
#include <xmc_i2c.h>
#include <xmc_i2s.h>
#include <xmc_can.h>

//****************************************************************************
// @Defines
Expand Down Expand Up @@ -247,9 +248,40 @@ extern "C" {
#endif
} XMC_I2S_t;

//****************************************************************************
// @Imported Global Variables
//****************************************************************************
#ifdef CAN_xmc
/*
* XMC (Arduino) CAN type
*/

typedef enum
{
XMC_NODE_NUM_0,
XMC_NODE_NUM_1
}
XMC_CAN_NODE_NUM_t;

typedef struct
{
CAN_NODE_TypeDef *can_node;
XMC_CAN_NODE_NUM_t can_node_num;
XMC_CAN_CANCLKSRC_t can_clock;
uint32_t can_frequency;
XMC_PORT_PIN_t rx;
XMC_GPIO_CONFIG_t rx_config;
XMC_PORT_PIN_t tx;
XMC_GPIO_CONFIG_t tx_config;
XMC_CAN_NODE_RECEIVE_INPUT_t node_input;
IRQn_Type irq_num;
uint32_t irq_service_request;
#if (UC_SERIES == XMC14)
XMC_SCU_IRQCTRL_t irq_source;
#endif
} XMC_ARD_CAN_t;
#endif

//****************************************************************************
// @Imported Global Variables
//****************************************************************************
extern const XMC_PORT_PIN_t mapping_port_pin[];
extern const XMC_PIN_INTERRUPT_t mapping_interrupt[];
extern const uint8_t mapping_pin_PWM4[][ 2 ];
Expand Down Expand Up @@ -277,6 +309,9 @@ extern "C" {

extern XMC_I2S_t i2s_config;

#ifdef CAN_xmc
extern XMC_ARD_CAN_t XMC_CAN_0;
#endif
//****************************************************************************
// @Prototypes Of Global Functions
//****************************************************************************
Expand Down
18 changes: 18 additions & 0 deletions cores/xmc_lib/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Develop notes
## XMCLib version
The current one is V4.3.0. The macro of XMCLib version is also defined in ```cores\xmc_lib\XMCLib\inc\xmc_common.h```

## CAN macro

Because XMClibs use CAN macro, conflicts with Arduino default CAN class name, so we manually changed XMClib (CAN -> CAN_xmc).
changed files:

.h header files:
- XMCLib\inc\xmc_can.h
- XMCLib\inc\xmc_pau.h
- XMCLib\inc\xmc1_scu.h
- XMCLib\inc\xmc4_scu.h

.c source files:
- XMCLib\src\xmc_can.c
- XMCLib\src\xmc1_scu.c
38 changes: 25 additions & 13 deletions cores/xmc_lib/XMCLib/License.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
License Terms and Copyright Information
=======================================

Copyright (c) 2015-2016, Infineon Technologies AG All rights reserved.
Copyright (c) 2015-2023, Infineon Technologies AG All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote products derived from this software
without specific prior written permission.
Boost Software License - Version 1.0 - August 17th, 2003

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:

To improve the quality of the software, users are encouraged to share modifications, enhancements or bug fixes with Infineon Technologies AG (support@infineon.com).
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

To improve the quality of the software, users are encouraged to share modifications,
enhancements or bug fixes with Infineon Technologies AG at XMCSupport@infineon.com.
80 changes: 0 additions & 80 deletions cores/xmc_lib/XMCLib/Readme.txt

This file was deleted.

Loading

0 comments on commit 0c59b41

Please sign in to comment.