MCPcopy Create free account
hub / github.com/ArduPilot/ardupilot / check_low_memory_is_zero

Method check_low_memory_is_zero

libraries/AP_HAL_ChibiOS/Scheduler.cpp:604–626  ·  view source on GitHub ↗

the H7 has 64k of ITCM memory at address zero. We reserve 1k of it to prevent nullptr being valid. This function checks that memory is always zero */

Source from the content-addressed store, hash-verified

602 always zero
603 */
604void Scheduler::check_low_memory_is_zero()
605{
606 const uint32_t *lowmem = nullptr;
607 // we start at address 0x1 as reading address zero causes a fault
608 for (uint16_t i=1; i<256; i++) {
609 if (lowmem[i] != 0) {
610 // re-use memory guard internal error
611 AP_memory_guard_error(1023);
612 break;
613 }
614 }
615 // we can't do address 0, but can check next 3 bytes
616 const uint8_t *addr0 = (const uint8_t *)0;
617 for (uint8_t i=1; i<4; i++) {
618#pragma GCC diagnostic push
619#pragma GCC diagnostic ignored "-Warray-bounds"
620 if (addr0[i] != 0) {
621 AP_memory_guard_error(1023);
622 break;
623 }
624#pragma GCC diagnostic pop
625 }
626}
627#endif // STM32H7
628
629void Scheduler::_storage_thread(void* arg)

Callers 1

_storage_threadMethod · 0.80

Calls 1

AP_memory_guard_errorFunction · 0.85

Tested by

no test coverage detected