|
| 1 | +# OpenLog Artemis : How To Compile The OLA Firmware Binary |
| 2 | + |
| 3 | +These are _abbreviated_ instructions on how to compile the OLA firmware. It's more of an aide-memoire really... Sorry about that. |
| 4 | + |
| 5 | +## Install Arduino IDE |
| 6 | + |
| 7 | +Tested version: 1.8.19 |
| 8 | + |
| 9 | +(IDE version 2 has not been tested) |
| 10 | + |
| 11 | +## Add Apollo3 To The Additional Boards Manager URLs |
| 12 | + |
| 13 | +Open `File \ Preferences` |
| 14 | + |
| 15 | +Click the File icon to the right of the `Additional Boards Manager URLs` text box |
| 16 | + |
| 17 | +Add: |
| 18 | + |
| 19 | +``` |
| 20 | +https://raw.githubusercontent.com/sparkfun/Arduino_Apollo3/master/package_sparkfun_apollo3_index.json |
| 21 | +``` |
| 22 | + |
| 23 | +Click OK |
| 24 | + |
| 25 | +Click OK |
| 26 | + |
| 27 | +Close and re-open the IDE |
| 28 | + |
| 29 | +## Install the Apollo3 Board Package |
| 30 | + |
| 31 | +Open `Tools \ Board \ Boards Manager` |
| 32 | + |
| 33 | +Enter `Apollo3` in the search box |
| 34 | + |
| 35 | +Install the SparkFun Apollo3 Boards. Tested version: 2.2.1 |
| 36 | + |
| 37 | +## Install All The Required Libraries |
| 38 | + |
| 39 | +Copy and paste the following into an empty sketch. Click on each link in turn to install the libraries via the Library Manager: |
| 40 | + |
| 41 | +``` |
| 42 | +// SdFat by Bill Greiman (Tested version: 2.2.0): http://librarymanager/All#SdFat_exFAT |
| 43 | +// http://librarymanager/All#SparkFun_ICM_20948_IMU |
| 44 | +// http://librarymanager/All#SparkFun_I2C_Mux |
| 45 | +// http://librarymanager/All#SparkFun_CCS811 |
| 46 | +// http://librarymanager/All#SparkFun_VL53L1X |
| 47 | +// http://librarymanager/All#SparkFun_BME280 |
| 48 | +// http://librarymanager/All#SparkFun_LPS25HB |
| 49 | +// http://librarymanager/All#SparkFun_VEML6075 |
| 50 | +// http://librarymanager/All#SparkFun_PHT_MS8607 |
| 51 | +// http://librarymanager/All#SparkFun_MCP9600 |
| 52 | +// http://librarymanager/All#SparkFun_SGP30 |
| 53 | +// http://librarymanager/All#SparkFun_VCNL4040 |
| 54 | +// http://librarymanager/All#SparkFun_MS5637 |
| 55 | +// http://librarymanager/All#SparkFun_TMP117 |
| 56 | +// http://librarymanager/All#SparkFun_u-blox_GNSS |
| 57 | +// http://librarymanager/All#SparkFun_NAU7802 |
| 58 | +// http://librarymanager/All#SparkFun_SCD30 |
| 59 | +// http://librarymanager/All#Qwiic_Humidity_AHT20 |
| 60 | +// http://librarymanager/All#SparkFun_SHTC3 |
| 61 | +// http://librarymanager/All#SparkFun_ADS122C04 |
| 62 | +// http://librarymanager/All#SparkFun_MicroPressure |
| 63 | +// http://librarymanager/All#SparkFun_Particle_Sensor_SN-GCJA5 |
| 64 | +// http://librarymanager/All#SparkFun_SGP40 |
| 65 | +// http://librarymanager/All#SparkFun_SDP3x |
| 66 | +// Blue Robotics MS5837 (Required version: 1.1.1): http://librarymanager/All#BlueRobotics_MS5837 |
| 67 | +// http://librarymanager/All#SparkFun_Qwiic_Button_Switch |
| 68 | +// http://librarymanager/All#SparkFun_Bio_Sensor |
| 69 | +// http://librarymanager/All#SparkFun_6DoF_ISM330DHCX |
| 70 | +// http://librarymanager/All#SparkFun_MMC5983MA |
| 71 | +// http://librarymanager/All#SparkFun_ADS1015 |
| 72 | +// http://librarymanager/All#SparkFun_KX13X |
| 73 | +``` |
| 74 | + |
| 75 | +## Download the OLA Firmware Zip |
| 76 | + |
| 77 | +Open this link in a web browser to download a complete Zip of the OLA firmware repo: |
| 78 | + |
| 79 | +https://github.com/sparkfun/OpenLog_Artemis/archive/refs/heads/main.zip |
| 80 | + |
| 81 | +Unzip it (Extract All files) |
| 82 | + |
| 83 | +## Copy the OLA Source Code |
| 84 | + |
| 85 | +Navigate to the Firmware sub-folder |
| 86 | + |
| 87 | +Copy the entire `OpenLog_Artemis` folder from the Zip file into your `Arduino` folder. This contains the source code for the firmware. The result should be: |
| 88 | + |
| 89 | +``` |
| 90 | +C:\Users\<Your_User>\Documents\Arduino\OpenLog_Artemis |
| 91 | +``` |
| 92 | + |
| 93 | +## Copy Paulvha's Patch for Apollo3 |
| 94 | + |
| 95 | +Navigate to the `Extras` folder in the Zip file. Copy the `UartPower3.zip` file. Paste it into the Apollo3 board package folder. On Windows machines, this is (usually): |
| 96 | + |
| 97 | +``` |
| 98 | +C:\Users\<Your_User>\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3 |
| 99 | +``` |
| 100 | + |
| 101 | +Unzip it (Extract All files) |
| 102 | + |
| 103 | +## Update the Apollo3 Core |
| 104 | + |
| 105 | +**Close the Arduino IDE** |
| 106 | + |
| 107 | +For information, open this link in a web browser: https://github.com/sparkfun/OpenLog_Artemis/issues/117#issuecomment-1085881142 |
| 108 | + |
| 109 | +Follow Paul's instructions contained in `uart_power_3.odt` |
| 110 | + |
| 111 | +Summary: replace the following five files with the ones from `UartPower3.zip` : |
| 112 | + |
| 113 | +``` |
| 114 | +C:\Users\<Your_User>\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\2.2.1\cores\arduino\mbed-bridge\core-extend\HardwareSerial.h |
| 115 | +C:\Users\<Your_User>\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\2.2.1\cores\arduino\mbed-bridge\core-implement\HardwareSerial.cpp |
| 116 | +C:\Users\<Your_User>\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\2.2.1\cores\mbed-os\drivers\UnbufferedSerial.h |
| 117 | +C:\Users\<Your_User>\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\2.2.1\cores\mbed-os\targets\TARGET_Ambiq_Micro\TARGET_Apollo3\device\serial_api.c |
| 118 | +C:\Users\<Your_User>\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\2.2.1\variants\SFE_ARTEMIS_ATP\mbed\libmbed-os.a |
| 119 | +``` |
| 120 | + |
| 121 | +## Update Apollo3 SPI.cpp |
| 122 | + |
| 123 | +Open the following file: |
| 124 | + |
| 125 | +``` |
| 126 | +C:\Users\<Your_User>\AppData\Local\Arduino15\packages\SparkFun\hardware\apollo3\2.2.1\libraries\SPI\src\SPI.cpp |
| 127 | +``` |
| 128 | + |
| 129 | +Search for `::end` |
| 130 | + |
| 131 | +Replace `::end` with: |
| 132 | + |
| 133 | +``` |
| 134 | +void arduino::MbedSPI::end() { |
| 135 | + if (dev) { |
| 136 | + delete dev; |
| 137 | + dev = NULL; |
| 138 | + } |
| 139 | +} |
| 140 | +``` |
| 141 | + |
| 142 | +Save the updated file |
| 143 | + |
| 144 | +The extra code prevents badness when the Artemis goes into deep sleep |
| 145 | + |
| 146 | +## Enable ICM29048 DMP Support |
| 147 | + |
| 148 | +Open the following file: |
| 149 | + |
| 150 | +``` |
| 151 | +C:\Users\pc235\Documents\Arduino\libraries\SparkFun_ICM-20948_ArduinoLibrary\src\util\ICM_20948_C.h |
| 152 | +``` |
| 153 | + |
| 154 | +Uncomment the following line (29): |
| 155 | + |
| 156 | +``` |
| 157 | +#define ICM_20948_USE_DMP // Uncomment this line to enable DMP support. You can of course use ICM_20948_USE_DMP as a compiler flag too |
| 158 | +``` |
| 159 | + |
| 160 | +Save the updated file |
| 161 | + |
| 162 | +## Compile / Upload the Code |
| 163 | + |
| 164 | +Re-open the Arduino IDE |
| 165 | + |
| 166 | +Open the main OLA Firmware .ino: |
| 167 | + |
| 168 | +``` |
| 169 | +C:\Users\<Your_User>\Documents\Arduino\OpenLog_Artemis\OpenLog_Artemis.ino |
| 170 | +``` |
| 171 | + |
| 172 | +Open the `Tools \ Board` menu. Select `SparkFun Apollo3 \ RedBoard Artemis ATP` |
| 173 | + |
| 174 | +If you have the OLA connected via USB, you can click the `Upload` (Right-Arrow) icon to compile the code and upload it onto the OLA |
| 175 | + |
| 176 | +(The compilation takes a long time. Go make a cup of tea...) |
| 177 | + |
| 178 | +If you want to be able to swap between firmware versions more quickly, use the `Sketch \ Export compiled Binary` to create a binary which |
| 179 | +you can upload with the `Artemis Firmware Upload GUI`. See [UPGRADE.md](./UPGRADE.md) for more details. |
| 180 | + |
| 181 | +## Board Versions |
| 182 | + |
| 183 | +If you are compiling for the Red (SparkFun) OLA: leave the hardware version defines as: |
| 184 | + |
| 185 | +``` |
| 186 | +#define HARDWARE_VERSION_MAJOR 1 |
| 187 | +#define HARDWARE_VERSION_MINOR 0 |
| 188 | +``` |
| 189 | + |
| 190 | +If you have an original Black (SparkX) OLA - way to go! Change those lines to: |
| 191 | + |
| 192 | +``` |
| 193 | +#define HARDWARE_VERSION_MAJOR 0 |
| 194 | +#define HARDWARE_VERSION_MINOR 4 |
| 195 | +``` |
| 196 | + |
| 197 | +## No Power Loss Protection |
| 198 | + |
| 199 | +To disable the sleep-on-power-loss functionality, uncomment this line: |
| 200 | + |
| 201 | +``` |
| 202 | +#define noPowerLossProtection // Uncomment this line to disable the sleep-on-power-loss functionality |
| 203 | +``` |
| 204 | + |
0 commit comments