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 */
| 602 | always zero |
| 603 | */ |
| 604 | void 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 | |
| 629 | void Scheduler::_storage_thread(void* arg) |
no test coverage detected