PCAN-Router cross compilation for Linux

Universal CAN Converter
Post Reply
User avatar
O.Hartkopp
Posts: 40
Joined: Fri 22. Nov 2013, 19:47

PCAN-Router cross compilation for Linux

Post by O.Hartkopp » Mon 26. May 2014, 18:54

Hey all,

as the shipped Yagarto GNU-ARM-Toolchain from http://www.yagarto.org/ is 'just' a comfortable package for Windows I asked myself if I could build PCAN-Router binaries in my prefered Linux environment :geek: .

It works! :D

So here's the short tutorial to build PCAN-Router binaries on Linux. I successfully tested the Linux-built binary from the Examples/1_ROUTING/.out/example_can.bin with the Windows PCANflash2 tool.
So having a commandline flash tool for Linux could be the next step to go :mrgreen:

Have fun,
Oliver

ps. Maybe the small changes regarding the Makefile and the fixed filename can go into future PCAN-Router packages - as it works for Windows and Linux now.

### PCAN Router TOOLCHAIN for Debian Linux (unstable / sid)

### Install debian packages with packet manager:

apt-get install gcc-arm-none-eabi
apt-get install binutils-arm-none-eabi

### Downloaded & installed sid packages by hand:

http://ftp.de.debian.org/debian/pool/ma ... -5_all.deb
dpkg -i libnewlib-dev_2.1.0-5_all.deb

http://ftp.de.debian.org/debian/pool/ma ... -5_all.deb
dpkg -i libnewlib-arm-none-eabi_2.1.0-5_all.deb

http://ftp.de.debian.org/debian/pool/ma ... +1_all.deb
dpkg -i libstdc++-arm-none-eabi-newlib_4.8.2-16+1_all.deb

### Result from 'dpkg -l'

ii binutils-arm-none-eabi 2.24-2+4 i386 GNU assembler, linker and binary utilities for ARM Cortex-A/R/M processors
ii gcc-arm-none-eabi 4.8.2-16+8 i386 GCC cross compiler for ARM Cortex-A/R/M processors
ii libnewlib-arm-none-eabi 2.1.0-5 all C library and math library compiled for bare metal using Cortex A/R/M
ii libnewlib-dev 2.1.0-5 all C library and math library intended for use on embedded systems
ii libstdc++-arm-none-eabi-newlib 4.8.2-16+1 all GNU Standard C++ Library v3 for ARM Cortex-A/R/M processors (newlib)

### Compile HEX2BIN tool for Linux

http://sourceforge.net/projects/hex2bin/
http://sourceforge.net/projects/hex2bin ... t/download
tar xvjf Hex2bin-1.0.10.tar.bz2
cd Hex2bin-1.0.10
make clean
make
make install
(installs hex2bin in /usr/local/bin/hex2bin)

### Makefile changes (works for Linux and Windows then)

diff Makefile~ Makefile
217c217
< HEX2BIN = hex2bin.exe
---
> HEX2BIN = hex2bin

### Renaming due to MSDOS naming inconsistency so that it fits the exact name in can_user.c (works for Linux and Windows then)

mv LPC21xx.h lpc21xx.h

(EOF)

Code: Select all

### PCAN Router TOOLCHAIN for Debian Linux (unstable / sid)

### Install debian packages with packet manager:

apt-get install gcc-arm-none-eabi 
apt-get install binutils-arm-none-eabi

### Downloaded & installed sid packages by hand:

http://ftp.de.debian.org/debian/pool/main/n/newlib/libnewlib-dev_2.1.0-5_all.deb
dpkg -i libnewlib-dev_2.1.0-5_all.deb 

http://ftp.de.debian.org/debian/pool/main/n/newlib/libnewlib-arm-none-eabi_2.1.0-5_all.deb
dpkg -i libnewlib-arm-none-eabi_2.1.0-5_all.deb 

http://ftp.de.debian.org/debian/pool/main/libs/libstdc++-arm-none-eabi/libstdc++-arm-none-eabi-newlib_4.8.2-16+1_all.deb
dpkg -i libstdc++-arm-none-eabi-newlib_4.8.2-16+1_all.deb

### Result from 'dpkg -l'

ii  binutils-arm-none-eabi                 2.24-2+4                           i386         GNU assembler, linker and binary utilities for ARM Cortex-A/R/M processors
ii  gcc-arm-none-eabi                      4.8.2-16+8                         i386         GCC cross compiler for ARM Cortex-A/R/M processors
ii  libnewlib-arm-none-eabi                2.1.0-5                            all          C library and math library compiled for bare metal using Cortex A/R/M
ii  libnewlib-dev                          2.1.0-5                            all          C library and math library intended for use on embedded systems
ii  libstdc++-arm-none-eabi-newlib         4.8.2-16+1                         all          GNU Standard C++ Library v3 for ARM Cortex-A/R/M processors (newlib)

### Compile HEX2BIN tool for Linux

http://sourceforge.net/projects/hex2bin/
http://sourceforge.net/projects/hex2bin/files/latest/download
tar xvjf Hex2bin-1.0.10.tar.bz2
cd Hex2bin-1.0.10
make clean
make
make install
(installs hex2bin in /usr/local/bin/hex2bin)

### Makefile changes (works for Linux and Windows then)

diff Makefile~ Makefile
217c217
< HEX2BIN = hex2bin.exe
---
> HEX2BIN = hex2bin

### Renaming due to MSDOS naming inconsistency so that it fits the exact name in can_user.c (works for Linux and Windows then)

mv LPC21xx.h lpc21xx.h

(EOF)

M.Maidhof
Support
Support
Posts: 1753
Joined: Wed 22. Sep 2010, 14:00

Re: PCAN-Router cross compilation for Linux

Post by M.Maidhof » Wed 28. May 2014, 12:38

Hi Olivier,

thank you, very nice! We will change those files on one of the next releases of the PCAN-Router package, to have a system available which will work under Windows and Linux. Maybe we will also find the time to generate a Linux CAN flash tool, to be able to flash the PCAN-Router by the chardev or socketCAN linux driver.

regards

Michael

User avatar
O.Hartkopp
Posts: 40
Joined: Fri 22. Nov 2013, 19:47

Re: PCAN-Router cross compilation for Linux

Post by O.Hartkopp » Fri 9. Jan 2015, 19:28

M.Maidhof wrote:We will change those files on one of the next releases of the PCAN-Router package, to have a system available which will work under Windows and Linux.
Hi Michael,

the examples in

http://www.peak-system.com/produktcd/?d ... /1_ROUTING

still show the problematic filenames. I assumed renaming two files would take 5 only minutes ... ;-)

Regards,
Oliver

M.Maidhof
Support
Support
Posts: 1753
Joined: Wed 22. Sep 2010, 14:00

Re: PCAN-Router cross compilation for Linux

Post by M.Maidhof » Mon 12. Jan 2015, 10:32

Hello Oliver,

thanks for the info. Yes those examples are still from 2013. It looks like 5 minutes work for you, but we have to modify, compile and test all examples for PCAN-Router, PCAN-Router Pro and PCAN-RS232 (including hardware tests). Just this small change will take some days for an engineer, and don´t forget the work for the new documenation for the different languages. That´s why the official new release of those examples was not ready yet, but it is in the pipe! Please understand that we have different higher priority tasks here at the moment, that ´s why those "small" changes could take a little bit longer. At the moment we havn´t any other customers, who wants to use the PCAN-Router development under Linux, due to the missing flashtool.

regards

Michael

wirsigl
Posts: 1
Joined: Wed 6. May 2015, 13:10

Re: PCAN-Router cross compilation for Linux

Post by wirsigl » Wed 6. May 2015, 13:18

Hi Michael,

I'm also interested in the flashtool for the PCAN-Router. So he is not the only one.


Regards,
Lutz

User avatar
O.Hartkopp
Posts: 40
Joined: Fri 22. Nov 2013, 19:47

Re: PCAN-Router cross compilation for Linux

Post by O.Hartkopp » Sat 18. Jun 2016, 12:47

Hi Lutz!
wirsigl wrote: I'm also interested in the flashtool for the PCAN-Router. So he is not the only one.
Please take a look at the brand new pcanflash:
http://www.peak-system.com/forum/viewto ... =34&t=1818

Regards,
Oliver

Post Reply