489
+ − 1 # Open Source Code for the OSTC4 Dive Computer #
+ − 2
+ − 3
+ − 4 ## Documentation ##
+ − 5
+ − 6 [Modules](Modules.md) page details the code organisation.
+ − 7 [Hardware Resources](Hardware Resources.md) page details the hardware parts,
+ − 8 the low-level, and the middle-ware drivers used to manage them.
+ − 9
+ − 10 ## How to Compile ? ##
+ − 11
+ − 12 Most of the code is written in _C-99_. A small glue is in assembly. Everything is compatible with
+ − 13 the _GCC_ toolchain for ARM processors.
+ − 14
+ − 15 * [Using OpenSTM32](Using OpenSTM32.md), the free integrated IDE from the OpenSTM32 community, based on GCC cross compiler within an _Eclipse_ environment. Project management and configuration. Compile & Link. Hardware debugger through a JTAG/SWD probe.
+ − 16
+ − 17 ## Other Tools ##
+ − 18
+ − 19 * [STM32F429I-DISC1](http://www.st.com/en/evaluation-tools/32f429idiscovery.html)
+ − 20 It is a chip (~ 20€) evaluation board, that contains a _STM32F429ZIT6_ CPU, 2MB flash ROM, 256KB RAM, a 320x240 LCD touch screen a few LEDs and a pair of buttons. Very cheap (~ 25 Euro).
+ − 21 It should allows to run _OSTC4 Discovery code_, but just for basic testing as it lacks all specific sensors, LCD screen 800x640 resolution and the 3 interface buttons.
+ − 22 _An interesting project would be to add a special compilation option to get some reasonable support on this chip debugging platform, emulating the screen and buttons..._
+ − 23
+ − 24 * [STM32 ST-LINK Utility](http://www.st.com/en/development-tools/stsw-link004.html) (**Windows only**) allow to do many things to the _discovery kit_ through its JTAG/SWD interface: upload & verify application code, dump memory. Provides both a _Graphical_ and a _Command Line_ interface.
+ − 25
+ − 26 * [STMStudio](http://www.st.com/en/development-tools/stm-studio-stm32.html) (**WINDOWS ONLY**) allows real-time inspection of an application running on the _discovery kit_.
+ − 27 It is connected through the JTAG/SWD interface.
+ − 28 It allows to read and write variables defined in the application's binary (ELF file). To display or to trace graphs (eg. to display gas loading during dive simulation ?)
+ − 29
+ − 30 * [OpenOCD](http://openocd.org/) is another command utility to speak JTAG/SWD. Seems hard to use directly (very low level commands). But _OpenSTM32 IDE_ do use it for programming and debugging, and you can copy configuration files from a working project. Note version 0.10 (or above) seems mandatory to dump firmware contents.
+ − 31
+ − 32 * _**OSTC4 with 2 SWD connectors**_, the ultimate debugging tool: a specially made OSTC4, with a pair of extra SWD connectors you can connect to any JTAG/SWD probe. Cannot dive (absolutely not water tight), but allows to debug code on the real hardware (ie. set break points, single step the code and read/write variables), using a standard JTAG/SWD debuggers (eg. a low cost [ST-Link/V2](http://www.st.com/stlinkv2) for ~ 25 euro).
+ − 33 _Note that heinrichs weikamp will freely provide SWD OSTC4 platform to programmer serious about involving in code development._
+ − 34
+ − 35 ## Other Resources ##
+ − 36
+ − 37 * The **Ultimate Reference** for everyone serious about the OSTC4 firmware details
+ − 38 and _HAL_ programming (1800 pages): [UM1725 HAL Users Manual] https://www.st.com/resource/en/user_manual/dm00105879.pdf
+ − 39 * Reserving memory from the linker script: https://mcuoneclipse.com/2012/11/01/defining-variables-at-absolute-addresses-with-gcc/
+ − 40 * Placing a variable at an absolute address: https://sourceware.org/binutils/docs-2.24/ld/Source-Code-Reference.html#Source-Code-Reference