summaryrefslogtreecommitdiff
authorkwilson <kwilsonpdx@gmail.com>2014-01-21 23:16:21 (GMT)
committer kwilson <kwilsonpdx@gmail.com>2014-01-21 23:16:21 (GMT)
commit3037c03557a40b47b9551e5422e5dd10c3e58c0c (patch) (side-by-side diff)
tree58cc35587e12d56cd99dd8b4e9504584509ef192
parent6623696b3e2b0bbfa9a3560ccc397b123948a259 (diff)
downloadwiki-3037c03557a40b47b9551e5422e5dd10c3e58c0c.zip
wiki-3037c03557a40b47b9551e5422e5dd10c3e58c0c.tar.gz
Added pages for firmware codereview and codestylee notes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--avionics.mdwn7
-rw-r--r--avionics/firmware/fw_codereview.mdwn24
-rw-r--r--avionics/firmware/fw_codestyle.mdwn25
-rw-r--r--avionics/firmware/fw_stm32f407.mdwn155
-rw-r--r--avionics/firmware/fw_todo.mdwn103
5 files changed, 308 insertions, 6 deletions
diff --git a/avionics.mdwn b/avionics.mdwn
index af7153d..04333ce 100644
--- a/avionics.mdwn
+++ b/avionics.mdwn
@@ -45,12 +45,7 @@ The AV4-NEXT section shows what we want to fly on our next flight. This list is
- Finish mechanical design (last motor?)
- TrackMaster-compatible PoE-powered "plate" for Rocket Tracks
- Mount video camera and SightLine integration
-- [[STM32 Firmware|avionics/av3_firmware/av3_stm32f407_firmware]]
- - Finish logging to uSD card infrastructure
- - Local and global timestamping
- - RNH firmware
- - ChibiOS Node6 board file
- - Implement Precision Time Protocol (PTP) on ChibiOS
+- [[STM32 Firmware|avionics/firmware/fw_stm32f407]]
# Avionics System Documentation
diff --git a/avionics/firmware/fw_codereview.mdwn b/avionics/firmware/fw_codereview.mdwn
new file mode 100644
index 0000000..a0203e1
--- a/dev/null
+++ b/avionics/firmware/fw_codereview.mdwn
@@ -0,0 +1,24 @@
+[[!meta title="Avionics Firmware Code Review Notes"]]
+
+[[!toc]]
+
+# Why Code Review
+
+- Code review is invaluable because the fresh perspective catches many suboptimal design decisions and bugs (how many times have you figured out the solution to a bug in the course of explaining the problem to someone else?). Beyond that, just knowing that someone else is going to look at our code forces us to hold ourselves to a higher standard than we often do when working by ourselves. Things get hectic near launch (though *perhaps* that is an argument for why code review during that time is even more important than ever) so we may have to modify things then, but as long as we expect to have more than one person who can understand the at the launch then there no excuse to not do it.
+
+- PSAS is a student organization and code review is an excellent way to learn and discuss why some choices in code design were made over others. In this aspect code reviews are more than just a way to check the source code, but an opportunity for members to develop new skills.
+
+# *Every* PSAS Launch is New
+
+- Relax, none of us have done this before.
+- If you aren't good at talking to people in groups, here is an opportunity to practice.
+- If you forgot to bring your sense of humor, run home and get it.
+
+
+# References
+
+- [Edited from Avionics List Email](http://lists.psas.pdx.edu/pipermail/psas-avionics/2014-January/012442.html)
+
+
+
+
diff --git a/avionics/firmware/fw_codestyle.mdwn b/avionics/firmware/fw_codestyle.mdwn
new file mode 100644
index 0000000..99b77f3
--- a/dev/null
+++ b/avionics/firmware/fw_codestyle.mdwn
@@ -0,0 +1,25 @@
+[[!meta title="Avionics Firmware Source Code Style Notes"]]
+
+[[!toc]]
+
+# Starting Outline
+
+1. The goal is a consistent structure for source files. In the absence of full-blown guided literate source documentation, to increase reader comprehension of source is to structure it consistently. All source files should contain the following sections, labeled as such by prominent, 80-character-wide comments with two or three preceding lines of whitespace:
+ 1. A Constant Definitions section, which contains all constants defined in the source file.
+ 1. A Global Variables section, which contains all mutable variables that are referred to by more than one function. Each variable must have an accompanying comment that explains how it should be used.
+ 1. For header files, a Public Declarations section that is self explanatory.
+ 1. For object files, a Private Declarations section for all private (i.e. static) functions that are necessary to support the public API but are not declared in the object file's accompanying header.
+ 1. A Definitions section containing definitions of all public and private functions (which must have been previously declared in the Public Declarations or Private Declarations section).
+1. A documenting comment for every function that justifies the function's existence, explaining how the arguments are used to do whatever it is the function does. If the function modifies or reads any global variables of the file, the comment must explain why and how this is done. This is very helpful for new members developing or reading the codebase because it not only helps them understand what the function does, but allows them to quickly triage which functions are most important to understand first when they are becoming familiar with the structure.
+
+
+# Examples
+
+- Link to example code on github.com/psas here?
+
+# References
+
+- [Edited from Avionics List Email](http://lists.psas.pdx.edu/pipermail/psas-avionics/2014-January/012442.html)
+
+
+
diff --git a/avionics/firmware/fw_stm32f407.mdwn b/avionics/firmware/fw_stm32f407.mdwn
new file mode 100644
index 0000000..581e4c1
--- a/dev/null
+++ b/avionics/firmware/fw_stm32f407.mdwn
@@ -0,0 +1,155 @@
+[[!meta title="PSAS STM32F407 Firmware Notes "]]
+
+
+[[!toc levels=3]]
+
+# This page is for Avionics Firmware notes (STM32F407)
+
+## See also
+
+[[Data Protocol|av3-data-protocol]]
+
+## Status
+
+- [[Firmware Source Issues|https://github.com/psas/stm32/issues]]
+- [[Our Status and Todo List|fw_todo]]
+
+## Code Review
+
+- [[Code Review Notes|fw_codereview]]
+
+## Code Style
+
+- [[Code Style Notes|fw_codestyle]]
+
+## Openocd Notes
+
+[[av3-stm32-openocd]]
+
+## Datapath Timing
+
+[[Datapath Timing | av3_firmware_datap]]
+
+## PSAS git repository for firmware
+
+<https://github.com/psas/stm32>
+
+[[Notes on Maintaining The Repository|av3_stm32_gitnotes]]
+
+## IP Address Assignments
+
+This has to be determined in the context of Rocketnet.
+
+### IP Ports Assignments
+
+Currently we are using 35000 and 35003. This will change
+
+## MAC Address Assignments
+
+We will use a *Locally Administered Address* for MAC addresses on the
+individual boards.
+
+## Precision Time Protocol (PTP)
+[[PTP Notes]]
+
+### Proposed MAC address templates for PSAS
+
+- The first byte should be 0xE6 (This is locally administered.)
+- The 'middle bytes' should be as shown below.
+- The lowest byte must be unique to each device on Rocketnet.
+
+{0xE6, 0x10, 0x20, 0x30, 0x40, 0x11}
+
+{0xE6, 0x10, 0x20, 0x30, 0x40, 0xaa}
+
+#### See also
+
+<http://en.wikipedia.org/wiki/MAC_address>
+
+## Instructions for Instalation and Execution of STM32 code
+Assumptions: Using Ubuntu Desktop 12.04
+
+**Clone the stm32 repo from PSAS’s Github account:**
+
+1. cd *preferred_git_dir*
+1. git clone git@github.com:psas/stm32.git
+
+**Initialize ChibiOS git subroutine and setup:**
+
+1. cd stm32
+1. git submodule update --init
+1. cd ChibiOS/ext
+1. unzip fatfs-0.9-patched.zip
+1. unzip lwip-1.4.1.zip
+1. unzip uip-1.0.patches.zip
+1. rm *.zip
+
+**Create directory for openocd and x-tools:**
+
+1. sudo mkdir /opt/psas
+1. sudo chown \<user\> /opt/psas
+
+**X-tools:**
+
+***New cross compiler***
+
+We will be using the cross compiler and tools built and supported by
+these people:
+
+<https://launchpad.net/gcc-arm-embedded>
+
+ Current Version: gcc-arm-none-eabi-4_7-2013q3-20130916
+
+Download the cross compiler for your system.
+
+Command Line:
+
+ wget https://launchpad.net/gcc-arm-embedded/4.7/4.7-2013-q3-update/+download/gcc-arm-none-eabi-4_7-2013q3-20130916-linux.tar.bz2
+
+Install instructions are here:
+
+<https://launchpad.net/gcc-arm-embedded/4.7/4.7-2013-q3-update/+download/readme.txt>
+
+There is also a PPA repository for Ubuntu. Read about it here:
+
+<https://launchpad.net/~terry.guo/+archive/gcc-arm-embedded>
+
+Currently, our build scripts expect the compiler to be found in your
+search path. That is, there is no assumption about where you decided
+to install your cross compiler.
+
+***Soon to be obsolete method***
+
+1. cp <preferred_git_dir>/stm32/toolchain/psas-xtool-compiler-<i386|amd64>.tgz /opt/psas
+1. cd /opt/psas
+1. tar -zxvf psas-xtool-compiler-<i386|amd64>.tgz
+
+**OpenOCD:**
+
+1. Download OpenOCD: http://sourceforge.net/projects/openocd/files/openocd/0.6.1/openocd-0.6.1.tar.gz/download and copy file to /opt/psas
+1. cd /opt/psas
+1. tar -zxvf openocd-0.6.1.tar.gz
+1. mv openocd-0.6.1/ openocd
+1. cd openocd
+1. sudo apt-get install libftdi-dev
+1. ./configure --enable-maintainer-mode --enable-ft2232_libftdi --enable-stlink --prefix /opt/psas/openocd
+1. make && sudo make install
+
+**Aliases:**
+
+Edit your .bashrc file and include these two aliases
+
+1. alias psas_stm="echo path is: $PATH; export PATH=/opt/psas/x-tools/stm32f407/arm-psas-eabi/bin:/opt/psas/openocd/bin/:/opt/eclipse:$PATH"
+1. alias st_ocd="sudo /opt/psas/openocd/bin/openocd -f olimex_stm32_e407.cfg --search /opt/psas/openocd/share/openocd/scripts"
+
+**How to cross-compile and program STM32-E407 board:**
+
+We’ll use the extintr example:
+
+1. Plug JTAG controller into STM32-E407 board and connect both devices to the computer via USB.
+1. cd *preferred_git_dir*/stm32/src/extintr
+1. psas_stm
+1. make
+1. make write (make write_stl for the stlink programmer)
+
+Note: I had: /opt/psas/psas/x-tools due to copy flub. If make fails to find arm-psas-eabi-gcc check that x-tools is in /opt/psas.
diff --git a/avionics/firmware/fw_todo.mdwn b/avionics/firmware/fw_todo.mdwn
new file mode 100644
index 0000000..e920e53
--- a/dev/null
+++ b/avionics/firmware/fw_todo.mdwn
@@ -0,0 +1,103 @@
+[[!meta title="Avionics Firmware Status and Project List"]]
+
+[[!toc]]
+
+# Acronym-soup
+
+- GFE : Generic Front End
+- RTC : Real Time Clock
+- PHY : A discrete IC for managing PHYsical layer ethernet signals.
+- GPS : Global Positioning System
+- IMU : Inertial Measurement Unit
+
+# Todo
+
+- Sketch out milestones and goals for next flight
+
+- Sensors
+ - Project: Self test on FC command request
+ - [Github issue 12](https://github.com/psas/stm32/issues/12)
+
+- Flight computer framework
+ - Project: stop/start/reset interface from FC for sensor data logging
+ - Project: diagnostic interface from FC (e.g. result of sensor self test)
+ - Project: Set stm32-gfe board RTC from GPS (or IEEE 1588-2008/PTP)
+
+- Log events (watchdog reset, commands) to local board (SD chip)
+ - Project: Event logging thread using ChibiOS mailbox datatype.
+ - Q: Header format for events derived from data header?
+
+- Log sensor data to local board (SD chip)
+ - Project: Python script to parse data from SD card.
+ - Project: Integrate sensors (ADIS, MPU, MPL) into an SD logging application with ethernet link to FC.
+ - Project: FCF will need to add a 'reset logging' command to force write from file position 0
+ - [Github issue 11](https://github.com/psas/stm32/issues/11)
+
+- KS8999 Switch on Rocketnet board
+ - How to integrate PSAS board requirements into ChibiOS *_lld.* files.
+ - Q: Use our own makefile which bypasses compile to ChibiOS *.lld.*?
+ - Q: Create a patch and a switch and push to mainline
+ - The ChibiOS developers may have other ideas.
+
+- Rocketnet Hub
+ - True ChibiOS sleep mode
+ - ADCs
+ - Logging
+ - Logic
+ - Armed marker
+
+- Software
+ - Code style and code reviews
+
+# Circuits
+
+- Firmware to verify battery charger circuits on Rocketnet Hub.
+- Battery backup for stm32 RTC.
+- New STM32 GFE board.
+
+# Done stuff
+
+- Software (Some of these issues will continue as permanent open discussions...)
+ - Project: Prune old branches from stm32.git repository
+ - Project: Now that we are past how to 'turn things on', we should maybe reorganize the src directory in stm32.git.
+ - Q: Separate src directories for each board? e407, rocketnet etc?
+ - Project: Should we switch to https://launchpad.net/gcc-arm-embedded for compiler?
+ - Project: How should we manage pulling from ChibiOS HEAD at https://github.com/mabl/ChibiOS.git
+ - Q: Make separate branch and test before merging back to master?
+ - A: We are now using a fork of Chibios on github.com/psas
+
+- KS8999 Switch on Rocketnet board
+ - datapath test success in stm32/src/rnet_mii_datap.
+ - This demonstrates packets from the stm32 through the switch to a laptop.
+
+- Log sensor data to local board (SD chip)
+ - Initial work available in stm32/src/sdlog_exp.
+
+- RTC
+ - Project: Develop better than 1S RTC
+ - This is under test in the stm32/src/common/psas_rtc* files.
+
+- Flight computer framework
+ - port elderberry project to ethernet-centric framework
+ - log sensor data over wifi
+- Flight Computer and Sensor Board Integration
+ - consistent data logging method
+ - integrate all sensors into datapath and fc logging
+- Sensors
+ - mpl9150 api
+ - adis16405 api
+ - mpl3115a2 api
+- Data Gathering
+ - end to end timing test (sensor ->fc->control ) [[Datapath Timing | av3_firmware_datap]]
+ - i2c for IMU mpu9150 and pressure sensor mpl3115a2
+ - integrate SPI IMU ADIS code into datapath code and fc logging.
+- Toolchain
+ - Create cross compilers for stm32f407 with hardware floating point
+ - Create basic interface for openocd and olimex ARM-USB-OCD JTAG programmer
+ - Create source tree and git repo (stm32)
+ - Compile and learn how to use ChibiOS
+- Firmware
+ - Create firmware for reading data from [[ADIS16405 IMU|http://psas.pdx.edu/avionics/av3-imu/#index2h2]]
+ - Create independent watchdog API for stm32f407
+ - Basic test of ethernet packet timing from dev board to flight computer
+ - Initial implementation and experiments with ethernet using LwIP stack in ChibiOS