Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Desmakers 2827 enable kit xmc14 2go into arduino ide #260

Merged
merged 11 commits into from
Jan 16, 2024
27 changes: 17 additions & 10 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.1.0'
version = '0.1.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 @@ -60,15 +60,20 @@ def get_package_sha256(pkg):
def get_latest_package_index_json():
return requests.get('https://github.com/Infineon/XMC-for-Arduino/releases/latest/download/package_infineon_index.json').json()

def get_local_package_index_json():
with open(os.path.join(xmc_ino_root_path, 'package/package_infineon_index.template.json'), 'r') as f:
data = json.load(f)
return data

def get_platform_data_struct_copy(pkg_index):
return copy.deepcopy(pkg_index['packages'][0]['platforms'][0])

def set_new_platform_data_fields(platform_data, pkg_name, version):
def set_new_platform_data_fields(platform_data, pkg_name, version, repository):
semver = strip_prefix_from_version(version)
platform_data['version'] = str(semver)
archive_file_name = str(pkg_name) + ".zip"
platform_data['archiveFileName'] = archive_file_name
platform_data['url'] = "https://github.com/Infineon/XMC-for-Arduino/releases/download/" + str(version) + "/" + str(archive_file_name)
platform_data['url'] = "https://github.com/" + str(repository) + "/releases/download/" + str(version) + "/" + str(archive_file_name)
platform_data['checksum'] ="SHA-256:" + str(get_package_sha256(os.path.join(pkg_assets_build_path, archive_file_name)))
platform_data['size'] = str(get_package_size(os.path.join(pkg_assets_build_path, archive_file_name)))

Expand All @@ -81,19 +86,20 @@ def make_package_index_file(pkg_index):
with open(pkg_index_w_path, "w") as pkg_file:
pkg_file.write(pkg_index_json_obj)

def build_package_index_json(pkg_name, version):
package_index = get_latest_package_index_json()
def build_package_index_json(pkg_name, version, repository):
# package_index = get_latest_package_index_json() # get online package index json
package_index = get_local_package_index_json() # get local package index template
jaenrig-ifx marked this conversation as resolved.
Show resolved Hide resolved
new_platform_data = get_platform_data_struct_copy(package_index)
set_new_platform_data_fields(new_platform_data, pkg_name, version)
set_new_platform_data_fields(new_platform_data, pkg_name, version, repository)
add_new_platform_to_package_index(package_index, new_platform_data)
make_package_index_file(package_index)

def build_release_assets(version):
def build_release_assets(args):
os.mkdir(pkg_assets_build_path)
pkg_name = mkdir_package_dir(version)
pkg_name = mkdir_package_dir(args.version)
build_package(pkg_name)
zip_package(pkg_name)
build_package_index_json(pkg_name, version)
build_package_index_json(pkg_name, args.version, args.repository)

def parser():

Expand All @@ -105,7 +111,7 @@ def parser_build_release_assets_func(args):
global pkg_build_path
xmc_ino_root_path = args.root_path
pkg_build_path = args.build_path
build_release_assets(args.version)
build_release_assets(args)

class ver_action(argparse.Action):
def __init__(self, option_strings, dest, **kwargs):
Expand All @@ -123,6 +129,7 @@ def __call__(self, parser, namespace, values, option_string, **kwargs):

# Release parser
parser_release = subparser.add_parser('build-release', description='Build package release assets')
parser_release.add_argument('repository', type=str, help='Repository name')
parser_release.add_argument('version', type=str, help='Package release version (format: Vx.y.z)')
parser_release.add_argument('-r','--root-path', type=str, default=xmc_ino_root_path, help='Path to the XMC-for-Arduino root path')
parser_release.add_argument('-b','--build-path', type=str, default=pkg_assets_build_path, help='Path to build package')
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/compile-platform-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ jobs:
multiSerial: true
dma: true
alarmRtc: true
- fqbn: Infineon:xmc:XMC1400_XMC2GO
i2s: true
dieTemp: true
heapMem: true
sleep1100: true
sleep4700 : false
stackMem: false
dma: false
alarmRtc: false
- fqbn: Infineon:xmc:XMC1400_Arduino_Kit
i2s: false
dieTemp: true
Expand Down Expand Up @@ -149,7 +158,7 @@ jobs:
platforms: |
# Use Boards Manager to install the latest release of the platform to get the toolchain.
- name: Infineon:xmc
source-url: https://github.com/Infineon/XMC-for-Arduino/releases/latest/download/package_infineon_index.json
source-url: https://github.com/${{ github.repository }}/releases/latest/download/package_infineon_index.json

- source-path: ./
name: Infineon:xmc
Expand All @@ -169,7 +178,7 @@ jobs:
${{ matrix.multiSerial-sketch-paths }}
${{ matrix.dma-sketch-paths }}
${{ matrix.alarmRtc-sketch-paths }}
enable-deltas-report: true
enable-deltas-report: false
sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }}

- name: Save sketches report as workflow artifact
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Build release assets
run: |
cd .github/scripts
python release.py build-release ${{ github.ref_name }}
python release.py build-release ${{ github.repository }} ${{ github.ref_name }}

- name: Upload assets
uses: softprops/action-gh-release@v1
Expand Down
17 changes: 17 additions & 0 deletions Contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,27 @@ Please contribute and raise issues via the [github repository](https://github.co

Check the **develop** branch for any Beta releases fixes for any issues you may find.

## Developer notes

General points on repository branches and flow

1. _master_ branch is intended to be copy of release version
2. Please make Pull Requests to _develop_ branch for review, inclusion and availability for others
3. At next release _develop_ is merged into _master_ for release
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

jaenrig-ifx marked this conversation as resolved.
Show resolved Hide resolved
### 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)
- Open the library location in Arduino program folder
`C:\Users\"USERNAME"\AppData\Local\Arduino15\packages\Infineon\hardware\xmc`
- Open git bash, type command:
`git clone "HTTP_SSH_REPOSITORY" "LIBRARY_VERSION (e.g. 2.2.0)"`

This is a workaround for current local compilation/testing.

### CICD

Currently github workflow is used for automaticaly build test and release. Workflows are defined by YAML file in the `.github/workflows` directory.
To merge your PR, please try to add a git tag in the format `VX.Y.Z` (e.g. V3.3.0) to trigger the release process in your fork and pass the compilation tests.
44 changes: 44 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,50 @@ XMC1300_Boot_Kit.menu.LIB.DSP.library.selected=-DARM_LIB_CMSIS_DSP
XMC1300_Boot_Kit.menu.LIB.DSPNN=ARM DSP / ARM NN Framework
XMC1300_Boot_Kit.menu.LIB.DSPNN.library.selected=-DARM_LIB_CMSIS_DSP -DARM_LIB_CMSIS_NN

####################################################
XMC1400_XMC2GO.name=XMC1400 XMC2GO
XMC1400_XMC2GO.upload.tool=xmcflasher
XMC1400_XMC2GO.upload.speed=115200
XMC1400_XMC2GO.upload.resetmethod=ck
XMC1400_XMC2GO.upload.maximum_size=65536
XMC1400_XMC2GO.upload.wait_for_upload_port=true

XMC1400_XMC2GO.communication=usb
XMC1400_XMC2GO.protocol=dragon_isp
XMC1400_XMC2GO.program.protocol=dragon_isp
XMC1400_XMC2GO.program.tool=xmcflasher
XMC1400_XMC2GO.program.extra_params=-Pusb

XMC1400_XMC2GO.serial.disableDTR=true
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.type=Q040x0200
XMC1400_XMC2GO.build.board.v=0200
XMC1400_XMC2GO.build.core=./
XMC1400_XMC2GO.build.variant=XMC1400
XMC1400_XMC2GO.build.board_variant=XMC1400_XMC2GO
XMC1400_XMC2GO.build.flash_size=200K
XMC1400_XMC2GO.build.flash_ld=linker_script_200k.ld
XMC1400_XMC2GO.build.extra_flags=-DARM_MATH_CM0 -DXMC1_SERIES

XMC1400_XMC2GO.menu.UART.debug=PC
XMC1400_XMC2GO.menu.UART.debug.uart.selected=-DSERIAL_HOSTPC
XMC1400_XMC2GO.menu.UART.onBoard=On Board
XMC1400_XMC2GO.menu.UART.onBoard.uart.selected=-DSERIAL_ONBOARD

XMC1400_XMC2GO.menu.LIB.NONE=None
XMC1400_XMC2GO.menu.LIB.NONE.library.selected=
XMC1400_XMC2GO.menu.LIB.NN=ARM NN Framework
XMC1400_XMC2GO.menu.LIB.NN.library.selected=-DARM_LIB_CMSIS_NN
XMC1400_XMC2GO.menu.LIB.DSP=ARM DSP
XMC1400_XMC2GO.menu.LIB.DSP.library.selected=-DARM_LIB_CMSIS_DSP
XMC1400_XMC2GO.menu.LIB.DSPNN=ARM DSP / ARM NN Framework
XMC1400_XMC2GO.menu.LIB.DSPNN.library.selected=-DARM_LIB_CMSIS_DSP -DARM_LIB_CMSIS_NN

####################################################
XMC1400_Arduino_Kit.name=XMC1400 Kit for Arduino
XMC1400_Arduino_Kit.upload.tool=xmcflasher
Expand Down
2 changes: 1 addition & 1 deletion cores/WInterrupts.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ void attachInterrupt(uint32_t interrupt_num, interrupt_cb_t callback, uint32_t m

if (pin_irq.irq_num == 0)
{
#if defined(XMC1100_Boot_Kit) || defined(XMC1400_Arduino_Kit)
#if defined(XMC1100_Boot_Kit) || defined(XMC1400_Arduino_Kit) || defined(XMC1400_XMC2GO)
/* P1_4 external interrupt goes through USIC to CCU4 */
XMC_USIC_CH_Enable(XMC_USIC0_CH0);
XMC_USIC_CH_SetInputSource(XMC_USIC0_CH0, XMC_USIC_CH_INPUT_DX5, USIC0_C0_DX5_P1_4);
Expand Down
3 changes: 3 additions & 0 deletions package/package_infineon_index.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
{
"name":"XMC1400 Kit for Arduino"
},
{
"name":"XMC1400 XMC2Go"
},
{
"name":"XMC4200 Platform 2Go"
},
Expand Down
Loading
Loading