Skip to content

Commit bbff998

Browse files
authored
Merge pull request #505 from pennam/prng-sha-fix
RP2040 Connect OTA fix appSize computation with cores using PRNG
2 parents da514bb + 6c8931c commit bbff998

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

src/ota/implementation/OTANanoRP2040.cpp

+15-4
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,27 @@ bool NANO_RP2040OTACloudProcess::isOtaCapable() {
116116
return true;
117117
}
118118

119-
// extern void* __stext;
119+
extern uint32_t __flash_binary_start;
120120
extern uint32_t __flash_binary_end;
121121

122+
#if defined(UNINITIALIZED_DATA_SECTION)
123+
extern uint32_t __uninitialized_data_start__;
124+
extern uint32_t __uninitialized_data_end__;
125+
#endif
122126

123127
void* NANO_RP2040OTACloudProcess::appStartAddress() {
124-
// return &__flash_binary_start;
128+
#if defined(UNINITIALIZED_DATA_SECTION)
129+
return &__flash_binary_start;
130+
#else
125131
return (void*)XIP_BASE;
132+
#endif
126133
}
127134
uint32_t NANO_RP2040OTACloudProcess::appSize() {
128-
return (&__flash_binary_end - (uint32_t*)appStartAddress())*sizeof(void*);
135+
#if defined(UNINITIALIZED_DATA_SECTION)
136+
return ((&__flash_binary_end - (uint32_t*)appStartAddress()) - (&__uninitialized_data_end__ - &__uninitialized_data_start__)) * sizeof(void*);
137+
#else
138+
return (&__flash_binary_end - (uint32_t*)appStartAddress()) * sizeof(void*);
139+
#endif
129140
}
130141

131-
#endif // defined(ARDUINO_NANO_RP2040_CONNECT) && OTA_ENABLED
142+
#endif // defined(ARDUINO_NANO_RP2040_CONNECT) && OTA_ENABLED

0 commit comments

Comments
 (0)