3. Source Code - mr-rooney/moitessier GitHub Wiki

Source Code

Content

The respository consists of several submodules that include the following:

  • Linux device driver to communicate with the HAT
  • User tools/applications to configure the operation mode and to update the firmware of the HAT
  • Firmware of the HAT microcontroller
  • Device tree and appropriate tools to write the ID EEPROM

Each submodules includes a README.md file for detailed information.

Getting the source code

It is assumed, that the cross-compilation is done on a host machine (development PC). This ensures faster compilation cycles.

host> git clone https://github.com/mr-rooney/moitessier.git
host> cd moitessier

only the first time after cloning...

host> git submodule update --init --recursive

...otherwise

host> git submodule update

The following steps need to be repeated for each submodule. <SUBMOUDLE> is a placeholder for the proper submodule name.

host> cd <SUBMODULE>
host> git checkout master
host> cd ..

Getting the compiler

If you are using a Raspberry Pi debian image, you either need to use the same compiler which was used to compile the kernel and associated modules included in this image, or you need to recompile kernel and modules using an alternate compiler. If you miss this step, your cross-compiled driver module cannot be loaded successfully.

However, it is suggested to use the official compiler used for the Raspberry Pi. The below commands are a summary from the Raspberry Pi web page.

host> sudo apt-get install git bc
host> git clone https://github.com/raspberrypi/tools toolchain
host> cd toolchain
host> echo PATH=\$PATH:~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin >> ~/.bashrc
host> source ~/.bashrc

Check if the system recognizes the compiler:

host> which arm-linux-gnueabihf-gcc

The command output should show something like this (depending on your installation path):

/home/development/Desktop/Raspberry/toolchain/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc

Compilation

The compilation/generation process is managed by the bash script create, if you want to compile all the sources at once. However, you might want to build the sources step by step. In this case, use the proper scripts/Makefiles in the subdirectories. You'll get the necessary instructions in the README.md files included in the subdirectories.

If you make changes on the source code file structure or you want to use a different compiler, you might need to adopt the configuration in this script.

Call the script without any parameter to create a debian package. This package needs to be copied to the Raspberry Pi and installed afterwards. Use the commands below with proper IP address to access the Raspberry Pi in your network.

host> ./create
host> scp -r deploy/moitessier_*_armhf.deb [email protected]:/home/pi/Desktop
pi> sudo dpkg -i ~/Desktop/moitessier_*_armhf.deb

After package installation, you'll find all the relevant files in /home/pi/moitessier. Be aware that the system will reboot automatically after installation.

⚠️ **GitHub.com Fallback** ⚠️