Skip to content

Commit

Permalink
Generate source code to populate OD base on ESI (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas71640 committed May 6, 2024
1 parent b76b4c0 commit feee277
Show file tree
Hide file tree
Showing 16 changed files with 13,237 additions and 19 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout@v2
- uses: turtlebrowser/[email protected]
with:
version: 2.0.9
version: 2.2.3

- name: GTest
run: |
Expand Down Expand Up @@ -59,7 +59,8 @@ jobs:
build_NuttX:
runs-on: ubuntu-latest
env:
nuttx_version: nuttx-12.5.0-RC0
nuttx_version: 3dc6b4c9bd9624ed259e676f8e9761dbf660c1bb
nuttx_apps_version: nuttx-12.5.0-RC0
arm_none_eabi_version: 13.2.Rel1/binrel/arm-gnu-toolchain-13.2.Rel1-x86_64-arm-none-eabi
steps:
- name: checkout KickCAT
Expand Down Expand Up @@ -87,15 +88,15 @@ jobs:
uses: actions/cache@v3
with:
path: ${{GITHUB.WORKSPACE}}/nuttxspace/apps
key: nuttx-apps_${{env.nuttx_version}}
key: nuttx-apps_${{env.nuttx_apps_version}}

- if: ${{ steps.cache-nuttx-apps.outputs.cache-hit != 'true' }}
name: checkout NuttX Apps
uses: actions/checkout@v4
with:
repository: apache/nuttx-apps
path: 'nuttxspace/apps'
ref: '${{env.nuttx_version}}'
ref: '${{env.nuttx_apps_version}}'

- name: Install Kconfig
run: sudo apt install kconfig-frontends
Expand Down Expand Up @@ -124,13 +125,11 @@ jobs:
nuttx_src=${{GITHUB.WORKSPACE}}/nuttxspace/nuttx
build=${{GITHUB.WORKSPACE}}/build_slave
src=${{GITHUB.WORKSPACE}}/KickCAT
nuttx_version=nuttx-export-12.5.0
cp ${src}/examples/slave/nuttx/xmc4800/boards/relax/defconfig ${nuttx_src}/boards/arm/xmc4/xmc4800-relax/configs/nsh/defconfig
${nuttx_src}/tools/configure.sh -l xmc4800-relax:nsh
make -C ${nuttx_src} savedefconfig
make -C ${nuttx_src} export
cp ${nuttx_src}/${nuttx_version}.tar.gz ${build}
tar xf ${build}/${nuttx_version}.tar.gz -C ${build}
cmake -B ${build} -S ${src} -DCMAKE_TOOLCHAIN_FILE=${build}/${nuttx_version}/scripts/toolchain.cmake
mkdir ${build}/nuttx-export
tar xf ${nuttx_src}/nuttx-export-*.tar.gz --strip-components=1 -C ${build}/nuttx-export
cmake -B ${build} -S ${src} -DCMAKE_TOOLCHAIN_FILE=${build}/nuttx-export/scripts/toolchain.cmake
make -C ${build}
7 changes: 6 additions & 1 deletion examples/master/wdc_foot/wdc_foot_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ int main(int argc, char* argv[])

bus.createMapping(io_buffer);

uint32_t identityObject[256];
uint32_t identityObjectSize = sizeof(identityObject);
bus.readSDO(bus.slaves()[0], 0x1018, 4, Bus::Access::PARTIAL, identityObject, &identityObjectSize, 1s);
printf("Firmware Version %02x\n", identityObject[0]);

bus.enableIRQ(EcatEvent::DL_STATUS,
[&]()
{
Expand All @@ -143,7 +148,7 @@ int main(int argc, char* argv[])
std::cerr << e.what() << std::endl;
return 1;
}

for (auto& slave: bus.slaves())
{
printInfo(slave);
Expand Down
4 changes: 2 additions & 2 deletions examples/slave/nuttx/xmc4800/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ cmake_minimum_required(VERSION 3.0.0)

project(xmc4800_slave CXX)

add_executable(xmc4800_relax main_relax.cc)
add_executable(xmc4800_relax main_relax.cc od_populator.cc)
target_link_libraries(xmc4800_relax kickcat)
set_kickcat_properties(xmc4800_relax)


add_executable(xmc4800_foot main_foot.cc)
add_executable(xmc4800_foot main_foot.cc od_populator.cc)
target_link_libraries(xmc4800_foot kickcat)
set_kickcat_properties(xmc4800_foot)
2 changes: 1 addition & 1 deletion examples/slave/nuttx/xmc4800/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- use the `export_nuttx_archive.sh` to build and deploy your app. You will need to tweak the paths in the script to match your environment.


#### Create you own application
#### Create your own application

- Create a new main and a new project in CMake. Edit `export_nuttx_archive.sh` to flash your binary.
- A minimal default EEPROM is included in the binary, it allows you to flash your own EEPROM description with the tool `KickCAT/tools/eeprom.cc`.
Expand Down
4 changes: 3 additions & 1 deletion examples/slave/nuttx/xmc4800/boards/relax/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ CONFIG_BOARD_LATE_INITIALIZE=y
CONFIG_BOARD_LOOPSPERMSEC=8000
CONFIG_CXX_EXCEPTION=y
CONFIG_CXX_RTTI=y
CONFIG_CXX_STANDARD="gnu++20"
CONFIG_HAVE_CXX=y
CONFIG_INIT_STACKSIZE=30000
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBCXX=y
CONFIG_LIBCXXTOOLCHAIN=y
CONFIG_LIBM=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_PTHREAD_MUTEX_TYPES=y
CONFIG_RAM_SIZE=262144
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
Expand Down
4 changes: 3 additions & 1 deletion examples/slave/nuttx/xmc4800/boards/wdc_foot/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ CONFIG_BOARD_LATE_INITIALIZE=y
CONFIG_BOARD_LOOPSPERMSEC=8000
CONFIG_CXX_EXCEPTION=y
CONFIG_CXX_RTTI=y
CONFIG_CXX_STANDARD="gnu++20"
CONFIG_HAVE_CXX=y
CONFIG_INIT_STACKSIZE=30000
CONFIG_INTELHEX_BINARY=y
CONFIG_LIBCXX=y
CONFIG_LIBCXXTOOLCHAIN=y
CONFIG_LIBM=y
CONFIG_PREALLOC_TIMERS=4
CONFIG_PTHREAD_MUTEX_TYPES=y
CONFIG_RAM_SIZE=262144
CONFIG_RAM_START=0x20000000
CONFIG_RAW_BINARY=y
Expand Down
2 changes: 1 addition & 1 deletion examples/slave/nuttx/xmc4800/export_nuttx_archive.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ src=~/wdc_workspace/src/KickCAT

bin=xmc4800_$project

nuttx_version=nuttx-export-12.5.0
nuttx_version=nuttx-export-12.5.1

rm -f ${nuttx_src}/${nuttx_version}.tar.gz
rm -rf ${build}/${nuttx_version}
Expand Down
Loading

0 comments on commit feee277

Please sign in to comment.