Skip to content

Commit 95f315a

Browse files
fix: firmware upgrade (#167)
* fix: firmware upgrade * Give read permissions * Quotes * More permissions * Remove permissions
1 parent e9c7b0c commit 95f315a

3 files changed

Lines changed: 17 additions & 6 deletions

File tree

postmaster/bootloader/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ target_link_libraries(postmaster.bootloader PUBLIC
2222
upgrade.boot_loader
2323
services.util
2424
hal_st.synchronous_stm32fxxx
25+
hal_st.instantiations
2526
)
2627

2728
halst_target_linker_scripts(TARGET postmaster.bootloader LINKER_SCRIPTS

postmaster/bootloader/Main.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#include "generated/stm32fxxx/PinoutTableDefault.hpp"
22
#include "hal_st/cortex/InterruptCortex.hpp"
3+
#include "hal_st/instantiations/NucleoTracerInfrastructure.hpp"
34
#include "hal_st/stm32fxxx/GpioStm.hpp"
45
#include "hal_st/synchronous_stm32fxxx/SynchronousFlashInternalStm.hpp"
56
#include "hal_st/synchronous_stm32fxxx/SynchronousSpiMasterStm.hpp"
67
#include "services/synchronous_util/SynchronousFlashRegion.hpp"
78
#include "services/synchronous_util/SynchronousFlashSpi.hpp"
89
#include "services/synchronous_util/SynchronousSpiMasterWithChipSelect.hpp"
10+
#include "services/tracer/GlobalTracer.hpp"
911
#include "upgrade/boot_loader/DecryptorNone.hpp"
1012
#include "upgrade/boot_loader/ImageUpgraderFlash.hpp"
1113
#include "upgrade/boot_loader/PackUpgrader.hpp"
@@ -31,13 +33,10 @@ constexpr services::SynchronousFlashSpiConfig CreateFlashConfig()
3133

3234
void ProcessUpgradePack(infra::ConstByteRange flashMemory, uint32_t flashOffset)
3335
{
34-
static hal::InterruptTable::WithStorage<128> interruptTable;
35-
static hal::GpioStm gpio(hal::pinoutTableDefaultStm, hal::analogTableDefaultStm);
36-
3736
static std::array<uint32_t, 12> sectorSizes{
38-
0x08000, 0x08000, 0x08000, 0x08000,
39-
0x20000, 0x40000, 0x40000, 0x40000,
40-
0x40000, 0x40000, 0x40000, 0x40000
37+
0x04000, 0x04000, 0x04000, 0x04000,
38+
0x10000, 0x20000, 0x20000, 0x20000,
39+
0x20000, 0x20000, 0x20000, 0x20000
4140
};
4241

4342
hal::SynchronousFlashInternalStm internalFlash(infra::MakeRange(sectorSizes), flashMemory);
@@ -94,6 +93,16 @@ int main()
9493
{
9594
HAL_Init();
9695

96+
static hal::InterruptTable::WithStorage<128> interruptTable;
97+
static hal::GpioStm gpio(hal::pinoutTableDefaultStm, hal::analogTableDefaultStm);
98+
99+
static hal::GpioPinStm traceUartTx{ hal::Port::D, 8 };
100+
static hal::SynchronousUartStmSendOnly traceUart{ 3, traceUartTx };
101+
static services::StreamWriterOnSynchronousSerialCommunication traceWriter{ traceUart };
102+
static infra::TextOutputStream::WithErrorPolicy tracerOutputStream{ traceWriter };
103+
static services::TracerToStream tracer{ tracerOutputStream };
104+
services::SetGlobalTracerInstance(tracer);
105+
97106
extern uint8_t _flash_start;
98107
extern uint8_t _flash_end;
99108
infra::ConstByteRange flashMemory(&_flash_start, &_flash_end);

postmaster/instantiations/SelfProgrammer.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ namespace main_
1616
, firmwareReceptorReporting(firmwareReceptorReboot, receiving)
1717
{
1818
page.SetReceptor(firmwareReceptorReporting);
19+
firmwareReceptor.FlashInitializationDone();
1920
}
2021

2122
application::FirmwareReceptorToFlash firmwareReceptor;

0 commit comments

Comments
 (0)