aboutsummaryrefslogtreecommitdiffhomepage
path: root/source
diff options
context:
space:
mode:
authorBen V. Brown <[email protected]>2023-08-02 15:52:49 +1000
committerGitHub <[email protected]>2023-08-02 15:52:49 +1000
commitc120af398addb847e10932c54112a3b0d43c1788 (patch)
tree17aa2be456fa3aa630aa1dfac4f1888fb28d75eb /source
parentc4fd383694dbf277918a2c8ad00edc6eeb558ca1 (diff)
parent2d7abc274ae6d25bc72dab505a1f94abddc2b4f9 (diff)
downloadIronOS-c120af398addb847e10932c54112a3b0d43c1788.tar.gz
IronOS-c120af398addb847e10932c54112a3b0d43c1788.zip
Merge branch 'dev' into Short-Detection
Diffstat (limited to 'source')
-rw-r--r--source/Core/BSP/BSP.h3
-rw-r--r--source/Core/BSP/MHP30/BSP.cpp5
-rw-r--r--source/Core/BSP/MHP30/configuration.h4
-rw-r--r--source/Core/BSP/Miniware/BSP.cpp5
-rw-r--r--source/Core/BSP/Pinecil/BSP.cpp5
-rw-r--r--source/Core/BSP/Pinecilv2/BSP.cpp11
-rw-r--r--source/Core/BSP/Pinecilv2/bl_mcu_sdk/drivers/bl702_driver/bl702_flash.ld2
-rw-r--r--source/Core/BSP/Pinecilv2/configuration.h16
-rw-r--r--source/Core/BSP/Sequre_S60/BSP.cpp5
-rw-r--r--source/Core/Threads/GUIThread.cpp3
-rw-r--r--source/Makefile3
11 files changed, 44 insertions, 18 deletions
diff --git a/source/Core/BSP/BSP.h b/source/Core/BSP/BSP.h
index db9f9814..626989fe 100644
--- a/source/Core/BSP/BSP.h
+++ b/source/Core/BSP/BSP.h
@@ -102,7 +102,10 @@ void setBuzzer(bool on);
uint8_t preStartChecks();
uint8_t preStartChecksDone();
+// Check if the tip or output mosfet is shorted (if possible)
bool isTipShorted();
+// Show the boot logo
+void showBootLogo(void);
#ifdef __cplusplus
}
#endif
diff --git a/source/Core/BSP/MHP30/BSP.cpp b/source/Core/BSP/MHP30/BSP.cpp
index ad3328f9..7d42019f 100644
--- a/source/Core/BSP/MHP30/BSP.cpp
+++ b/source/Core/BSP/MHP30/BSP.cpp
@@ -1,6 +1,7 @@
// BSP mapping functions
#include "BSP.h"
+#include "BootLogo.h"
#include "I2C_Wrapper.hpp"
#include "Pins.h"
#include "Setup.h"
@@ -472,4 +473,6 @@ uint64_t getDeviceID() {
uint8_t preStartChecksDone() { return 1; }
uint8_t getTipThermalMass() { return TIP_THERMAL_MASS; }
-uint8_t getTipInertia() { return TIP_THERMAL_MASS; } \ No newline at end of file
+uint8_t getTipInertia() { return TIP_THERMAL_MASS; }
+
+void showBootLogo(void) { BootLogo::handleShowingLogo((uint8_t *)FLASH_LOGOADDR); }
diff --git a/source/Core/BSP/MHP30/configuration.h b/source/Core/BSP/MHP30/configuration.h
index 5d4c2eb1..c99afc64 100644
--- a/source/Core/BSP/MHP30/configuration.h
+++ b/source/Core/BSP/MHP30/configuration.h
@@ -164,13 +164,13 @@
#define HARDWARE_MAX_WATTAGE_X10 650
#define TIP_THERMAL_MASS 65 // TODO, needs refinement
#define TIP_RESISTANCE 60 // x10 ohms, ~6 typical
-#endif /* MHP30 */
+#endif /* MHP30 */
#ifdef ACCEL_EXITS_ON_MOVEMENT
#define NO_SLEEP_MODE
#endif
-#define FLASH_LOGOADDR (0x08000000 + (62 * 1024))
+#define FLASH_LOGOADDR (0x08000000 + (126 * 1024))
#define SETTINGS_START_PAGE (0x08000000 + (127 * 1024))
#endif /* CONFIGURATION_H_ */
diff --git a/source/Core/BSP/Miniware/BSP.cpp b/source/Core/BSP/Miniware/BSP.cpp
index fe0068be..f7e2053b 100644
--- a/source/Core/BSP/Miniware/BSP.cpp
+++ b/source/Core/BSP/Miniware/BSP.cpp
@@ -1,6 +1,7 @@
// BSP mapping functions
#include "BSP.h"
+#include "BootLogo.h"
#include "I2C_Wrapper.hpp"
#include "Pins.h"
#include "Setup.h"
@@ -414,4 +415,6 @@ uint8_t getTipInertia() {
#else
return TIP_THERMAL_MASS;
#endif
-} \ No newline at end of file
+}
+
+void showBootLogo(void) { BootLogo::handleShowingLogo((uint8_t *)FLASH_LOGOADDR); }
diff --git a/source/Core/BSP/Pinecil/BSP.cpp b/source/Core/BSP/Pinecil/BSP.cpp
index ca9817f5..1c7a3888 100644
--- a/source/Core/BSP/Pinecil/BSP.cpp
+++ b/source/Core/BSP/Pinecil/BSP.cpp
@@ -1,6 +1,7 @@
// BSP mapping functions
#include "BSP.h"
+#include "BootLogo.h"
#include "I2C_Wrapper.hpp"
#include "IRQ.h"
#include "Pins.h"
@@ -97,4 +98,6 @@ bool isTipShorted() { return false; }
uint8_t preStartChecksDone() { return 1; }
uint8_t getTipThermalMass() { return TIP_THERMAL_MASS; }
-uint8_t getTipInertia() { return TIP_THERMAL_MASS; } \ No newline at end of file
+uint8_t getTipInertia() { return TIP_THERMAL_MASS; }
+
+void showBootLogo(void) { BootLogo::handleShowingLogo((uint8_t *)FLASH_LOGOADDR); }
diff --git a/source/Core/BSP/Pinecilv2/BSP.cpp b/source/Core/BSP/Pinecilv2/BSP.cpp
index 98476e07..35809866 100644
--- a/source/Core/BSP/Pinecilv2/BSP.cpp
+++ b/source/Core/BSP/Pinecilv2/BSP.cpp
@@ -1,6 +1,7 @@
// BSP mapping functions
#include "BSP.h"
+#include "BootLogo.h"
#include "I2C_Wrapper.hpp"
#include "IRQ.h"
#include "Pins.h"
@@ -10,6 +11,7 @@
#include "Utils.h"
#include "configuration.h"
#include "crc32.h"
+#include "hal_flash.h"
#include "history.hpp"
#include "main.hpp"
@@ -281,4 +283,11 @@ uint8_t getDeviceValidationStatus() {
uint32_t programmedHash = EF_Ctrl_Get_Key_Slot_w1();
uint32_t computedHash = gethash();
return programmedHash == computedHash ? 0 : 1;
-} \ No newline at end of file
+}
+
+void showBootLogo(void) {
+ uint8_t scratch[1024];
+ flash_read(FLASH_LOGOADDR - 0x23000000, scratch, 1024);
+
+ BootLogo::handleShowingLogo(scratch);
+}
diff --git a/source/Core/BSP/Pinecilv2/bl_mcu_sdk/drivers/bl702_driver/bl702_flash.ld b/source/Core/BSP/Pinecilv2/bl_mcu_sdk/drivers/bl702_driver/bl702_flash.ld
index 37165c60..2ae61c59 100644
--- a/source/Core/BSP/Pinecilv2/bl_mcu_sdk/drivers/bl702_driver/bl702_flash.ld
+++ b/source/Core/BSP/Pinecilv2/bl_mcu_sdk/drivers/bl702_driver/bl702_flash.ld
@@ -22,7 +22,7 @@ __EM_SIZE =8K;
MEMORY
{
- xip_memory (rx) : ORIGIN = 0x23000000, LENGTH = 1022K
+ xip_memory (rx) : ORIGIN = 0x23000000, LENGTH = 1008K /*1024 - 8K header - 4K*2 for settings and logo*/
itcm_memory (rx) : ORIGIN = 0x22014000, LENGTH = 12K
dtcm_memory (rx) : ORIGIN = 0x42014000, LENGTH = 8K
ram_memory (!rx) : ORIGIN = 0x42016000, LENGTH = 72K
diff --git a/source/Core/BSP/Pinecilv2/configuration.h b/source/Core/BSP/Pinecilv2/configuration.h
index 686f54f5..9cc198b2 100644
--- a/source/Core/BSP/Pinecilv2/configuration.h
+++ b/source/Core/BSP/Pinecilv2/configuration.h
@@ -63,10 +63,10 @@
* OLED Brightness
*
*/
-#define MIN_BRIGHTNESS 1 // Min OLED brightness selectable
-#define MAX_BRIGHTNESS 101 // Max OLED brightness selectable
-#define BRIGHTNESS_STEP 25 // OLED brightness increment
-#define DEFAULT_BRIGHTNESS 26 // default OLED brightness
+#define MIN_BRIGHTNESS 1 // Min OLED brightness selectable
+#define MAX_BRIGHTNESS 101 // Max OLED brightness selectable
+#define BRIGHTNESS_STEP 25 // OLED brightness increment
+#define DEFAULT_BRIGHTNESS 26 // default OLED brightness
/**
* Temp change settings
@@ -87,7 +87,7 @@
#define POWER_PULSE_DEFAULT 0
#else
#define POWER_PULSE_DEFAULT 5
-#endif /* Pinecil */
+#endif /* Pinecil */
#define POWER_PULSE_WAIT_DEFAULT 4 // Default rate of the power pulse: 4*2500 = 10000 ms = 10 s
#define POWER_PULSE_DURATION_DEFAULT 1 // Default duration of the power pulse: 1*250 = 250 ms
@@ -167,8 +167,10 @@
#define CANT_DIRECT_READ_SETTINGS
#endif /* Pinecilv2 */
-#define FLASH_LOGOADDR (0x23000000 + (1022 * 1024))
-#define FLASH_PAGE_SIZE (1024)
+#define FLASH_PAGE_SIZE (1024) // Read pages
+// Erase is 4 or 8 k size, so we pad these apart for now
+// If we ever get low on flash, will need better solution
+#define FLASH_LOGOADDR (0x23000000 + (1016 * FLASH_PAGE_SIZE))
#define SETTINGS_START_PAGE (1023 * FLASH_PAGE_SIZE) // Hal auto offsets base addr
#endif /* CONFIGURATION_H_ */
diff --git a/source/Core/BSP/Sequre_S60/BSP.cpp b/source/Core/BSP/Sequre_S60/BSP.cpp
index 14e9764b..25ad176e 100644
--- a/source/Core/BSP/Sequre_S60/BSP.cpp
+++ b/source/Core/BSP/Sequre_S60/BSP.cpp
@@ -1,6 +1,7 @@
// BSP mapping functions
#include "BSP.h"
+#include "BootLogo.h"
#include "HUB238.hpp"
#include "I2C_Wrapper.hpp"
#include "Pins.h"
@@ -236,4 +237,6 @@ uint8_t preStartChecksDone() { return 1; }
uint8_t getTipThermalMass() { return TIP_THERMAL_MASS; }
uint8_t getTipInertia() { return TIP_THERMAL_INERTIA; }
-void setBuzzer(bool on) {} \ No newline at end of file
+void setBuzzer(bool on) {}
+
+void showBootLogo(void) { BootLogo::handleShowingLogo((uint8_t *)FLASH_LOGOADDR); }
diff --git a/source/Core/Threads/GUIThread.cpp b/source/Core/Threads/GUIThread.cpp
index 97b0eddc..56dc6574 100644
--- a/source/Core/Threads/GUIThread.cpp
+++ b/source/Core/Threads/GUIThread.cpp
@@ -76,8 +76,7 @@ void startGUITask(void const *argument) {
currentTempTargetDegC = min(sleepTempDegC, 75);
}
- BootLogo::handleShowingLogo((uint8_t *)FLASH_LOGOADDR);
-
+ showBootLogo();
showWarnings();
if (getSettingValue(SettingsOptions::AutoStartMode)) {
// jump directly to the autostart mode
diff --git a/source/Makefile b/source/Makefile
index 7ffa4b95..d1c123a8 100644
--- a/source/Makefile
+++ b/source/Makefile
@@ -407,7 +407,8 @@ DEVICE_BSP_DIR=./Core/BSP/Pinecilv2
S_SRCS:=$(shell find $(PINECILV2_DIR) -type d \( -path $(PINECILV2_VENDOR_BSP_COMMON_DIR) \) -prune -false -o -type f -name '*.S') $(info $(S_SRCS) )
ASM_INC=$(DEVICE_INCLUDES)
LDSCRIPT=./Core/BSP/Pinecilv2/bl_mcu_sdk/drivers/bl702_driver/bl702_flash.ld
-
+DEVICE_DFU_ADDRESS=0x23000000
+# DFU starts at the beginning of flash
# Flags
CPUFLAGS=-march=rv32imafc \
-mabi=ilp32f \