Railuino

 


Hacking your Märklin

This library allows you to control your digital Märklin railway using Arduino.

https://code.google.com/archive/p/railuino/

I want to show especially the output of the C++ compiled library

include <Railuino.h>

Any ISP will need what Arduino calls output binaries and the rest of the world calls HEX files. These are produced when you Verify/Compile your sketch and contain the data the AVR microcontroller needs to run and in my case “C:\Users\max\AppData\Local\Temp\arduino_build_130743”.

The Arduino IDE creates them in temporary folders in your user libraries. If everything has gone right, your folder should be full of output files, mostly with .o and .d extensions. These are used by linker and can be ignored.

The important files will be these, where the sketch is called CV.ino, so look for your own sketch name – so I show the top 6 files in the right sequence with explanation (below you can see the full verbose log mode):

  • CV.ino – the sketch as script before transformed to cpp++
  • CV.ino.cpp – output C file, actually C++
  • CV.ino.cpp.o – output for the linker
  • CV.ino.elf – output file for a debugger
  • CV.ino.eep – EEPROM file for programmer
  • CV.ino.hex – flash (code) file for programmer

The C file (.cpp) and Elf file (.elf) can be used in AVR Studio development environment if you want to move away from just using Arduino IDE.

The important files for the programmer are the .Hex and .EEP files.

Arduino 1.8.4 with compiled Railuino  

 

Install the Package (zip)

Installation is easy: Just get the latest release from the downloads page (see above Google Code Archive) and place the contents of the “src” directory in a “Railuino” directory under your Arduino “libraries” directory. I did also a properties file to better integrate in the Arduino IDE with paragraph and includes, but that’s not so important and not a must.

Lib Location of Arduino 

In case of problems:

There are three common causes of the invalid library warning:

1
2
3
1. You saved a sketch to the libraries folder. Sketches are only allowed in that folder as examples inside the folder of a valid library. Fix: move the sketch anywhere else other than the libraries folder.
 
2. Incorrect installation of a valid library. The library folder must be directly under the libraries folder, not in a sub-folder. This means the library must have either a .h file or a library.properties file in its root folder. Fix: move the library folder to directly under the libraries folder.
 
3. Something that's neither library nor sketch in the libraries folder
 

Then restart Arduino. You should now see a bunch of new examples that teach you how to use Railuino. The “Misc/Tests” example is a good way of validating your setup.

For documentation on the functions I currently recommend to read the comments in the “Railuino.h” header file. There are also several sets of slides on the downloads page that describe the overall approach and the hardware. Finally, there is a video from LinuxTag and another one from DroidConNL on YouTube.

Full Verbose Log

1
C:\Program Files (x86)\Arduino184\arduino-builder -dump-prefs -log
 

 

  • CV.ino – the Sketch as Script

C:\Program Files (x86)\Arduino184\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino184\hardware -hardware C:\Users\max\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino184\tools-builder -tools C:\Program Files (x86)\Arduino184\hardware\tools\avr -tools C:\Users\max\AppData\Local\Arduino15\packages -built-in-libraries

C:\Program Files (x86)\Arduino184\libraries -libraries C:\Users\max\Documents\Arduino\libraries -fqbn=arduino:avr:uno -ide-version=10804 -build-path C:\Users\max\AppData\Local\Temp\arduino_build_130743 -warnings=none -build-cache C:\Users\max\AppData\Local\Temp\arduino_cache_811198 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.avrdude.path=C:\Program Files (x86)\Arduino184\hardware\tools\avr -prefs=runtime.tools.avr-gcc.path=C:\Program Files (x86)\Arduino184\hardware\tools\avr -prefs=runtime.tools.arduinoOTA.path=C:\Program Files (x86)\Arduino184\hardware\tools\avr -verbose C:\Users\max\Documents\Arduino\libraries\Railuino\src\examples\01.Controller\CV\CV.ino
Using board ‘uno’ from platform in folder: C:\Program Files (x86)\Arduino184\hardware\arduino\avr

Using core ‘arduino’ from platform in folder: C:\Program Files (x86)\Arduino184\hardware\arduino\avr


Detecting libraries used…
“C:\Program Files (x86)\Arduino184\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10804 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino184\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino184\hardware\arduino\avr\variants\standard” “C:\Users\max\AppData\Local\Temp\arduino_build_130743\sketch\CV.ino.cpp” -o “nul”


“C:\Program Files (x86)\Arduino184\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10804 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino184\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino184\hardware\arduino\avr\variants\standard” “-IC:\Users\max\Documents\Arduino\libraries\Railuino” “C:\Users\max\AppData\Local\Temp\arduino_build_130743\sketch\CV.ino.cpp” -o “nul”

  • CV.ino.cpp

Using cached library dependencies for file: C:\Users\max\Documents\Arduino\libraries\Railuino\Railuino.cpp
Generating function prototypes…
“C:\Program Files (x86)\Arduino184\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10804 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino184\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino184\hardware\arduino\avr\variants\standard” “-IC:\Users\max\Documents\Arduino\libraries\Railuino” “C:\Users\max\AppData\Local\Temp\arduino_build_130743\sketch\CV.ino.cpp” -o “C:\Users\max\AppData\Local\Temp\arduino_build_130743\preproc\ctags_target_for_gcc_minus_e.cpp”
“C:\Program Files (x86)\Arduino184\tools-builder\ctags\5.8-arduino11/ctags” -u –language-force=c++ -f – –c++-kinds=svpf –fields=KSTtzns –line-directives “C:\Users\max\AppData\Local\Temp\arduino_build_130743\preproc\ctags_target_for_gcc_minus_e.cpp”


Compiling sketch…
“C:\Program Files (x86)\Arduino184\hardware\tools\avr/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10804 -DARDUINO_AVR_UNO -DARDUINO_ARCH_AVR “-IC:\Program Files (x86)\Arduino184\hardware\arduino\avr\cores\arduino” “-IC:\Program Files (x86)\Arduino184\hardware\arduino\avr\variants\standard” “-IC:\Users\max\Documents\Arduino\libraries\Railuino” “C:\Users\max\AppData\Local\Temp\arduino_build_130743\sketch\CV.ino.cpp” -o “C:\Users\max\AppData\Local\Temp\arduino_build_130743\sketch\CV.ino.cpp.o”

  • CV.ino.cpp.o

Compiling libraries…
Compiling library “Railuino”
Using previously compiled file: C:\Users\max\AppData\Local\Temp\arduino_build_130743\libraries\Railuino\Railuino.cpp.o
Compiling core…
Using precompiled core
Linking everything together…
“C:\Program Files (x86)\Arduino184\hardware\tools\avr/bin/avr-gcc” -w -Os -g -flto -fuse-linker-plugin -Wl,–gc-sections -mmcu=atmega328p -o “C:\Users\max\AppData\Local\Temp\arduino_build_130743/CV.ino.elf”

  • CV.ino.elf

“C:\Users\max\AppData\Local\Temp\arduino_build_130743\sketch\CV.ino.cpp.o” “C:\Users\max\AppData\Local\Temp\arduino_build_130743\libraries\Railuino\Railuino.cpp.o” “C:\Users\max\AppData\Local\Temp\arduino_build_130743/..\arduino_cache_811198\core\core_arduino_avr_uno_e2943c849c7d54ca2ad3fdc0ef151476.a” “-LC:\Users\max\AppData\Local\Temp\arduino_build_130743” -lm
“C:\Program Files (x86)\Arduino184\hardware\tools\avr/bin/avr-objcopy” -O ihex -j .eeprom –set-section-flags=.eeprom=alloc,load –no-change-warnings –change-section-lma .eeprom=0 “C:\Users\max\AppData\Local\Temp\arduino_build_130743/CV.ino.elf” “C:\Users\max\AppData\Local\Temp\arduino_build_130743/CV.ino.eep”

  • CV.ino.eep

“C:\Program Files (x86)\Arduino184\hardware\tools\avr/bin/avr-objcopy” -O ihex -R .eeprom “C:\Users\max\AppData\Local\Temp\arduino_build_130743/CV.ino.elf” “C:\Users\max\AppData\Local\Temp\arduino_build_130743/CV.ino.hex”

  • CV.ino.hex

Using library Railuino in folder: C:\Users\max\Documents\Arduino\libraries\Railuino (legacy)
Sketch uses 7714 bytes (23%) of program storage space. Maximum is 32256 bytes.
Global variables use 809 bytes (39%) of dynamic memory, leaving 1239 bytes for local variables. Maximum is 2048 bytes.

This is another context from Railuino to TensorFlowLite

There’s a second framework called Ardurail.

https://sourceforge.net/p/ardurail/wiki/Home/

This library allows you to create a digital Märklin(tm)-Motorola(tm) compatible signal for driving model-rail locomotives and track switches. You also need:

  1. a booster (a kind of digital amplifier, see http://en.wikipedia.org/wiki/Digital_model_railway_control_systems#Booster)
  2. some external controller (light pots, switches, buttons, …) or
  3. some external hard/software which speaks the Märklin(tm) P50-protocol over a serial interface (like [RocRail (http://wiki.rocrail.net) or [srcpd (http://srcpd.sourceforge.net/) in conjunction with the derived Ardurail_P50 class.
Ardurail on Arduino
As a Shell Control Console
maXbox Mac

 

 

 

 

Comments

Popular posts from this blog

CNN Pipeline Train

Google Safe Browsing API

TEE Models List