|
@@ -51,7 +51,7 @@
|
51
|
51
|
* Also, there are two support functions that can be called from a developer's C code.
|
52
|
52
|
*
|
53
|
53
|
* uint16_t check_for_free_memory_corruption(PGM_P const free_memory_start);
|
54
|
|
- * void M100_dump_routine(PGM_P const title, char *start, char *end);
|
|
54
|
+ * void M100_dump_routine(PGM_P const title, const char * const start, const char * const end);
|
55
|
55
|
*
|
56
|
56
|
* Initial version by Roxy-3D
|
57
|
57
|
*/
|
|
@@ -151,8 +151,8 @@ inline int32_t count_test_bytes(const char * const start_free_memory) {
|
151
|
151
|
// Start and end the dump on a nice 16 byte boundary
|
152
|
152
|
// (even though the values are not 16-byte aligned).
|
153
|
153
|
//
|
154
|
|
- start_free_memory = (char*)((ptr_int_t)((uint32_t)start_free_memory & 0xFFFFFFF0)); // Align to 16-byte boundary
|
155
|
|
- end_free_memory = (char*)((ptr_int_t)((uint32_t)end_free_memory | 0x0000000F)); // Align end_free_memory to the 15th byte (at or above end_free_memory)
|
|
154
|
+ start_free_memory = (char*)(ptr_int_t(uint32_t(start_free_memory) & ~0xFUL)); // Align to 16-byte boundary
|
|
155
|
+ end_free_memory = (char*)(ptr_int_t(uint32_t(end_free_memory) | 0xFUL)); // Align end_free_memory to the 15th byte (at or above end_free_memory)
|
156
|
156
|
|
157
|
157
|
// Dump command main loop
|
158
|
158
|
while (start_free_memory < end_free_memory) {
|
|
@@ -177,15 +177,16 @@ inline int32_t count_test_bytes(const char * const start_free_memory) {
|
177
|
177
|
}
|
178
|
178
|
}
|
179
|
179
|
|
180
|
|
- void M100_dump_routine(PGM_P const title, char *start, char *end) {
|
|
180
|
+ void M100_dump_routine(PGM_P const title, const char * const start, const char * const end) {
|
181
|
181
|
serialprintPGM(title);
|
182
|
182
|
SERIAL_EOL();
|
183
|
183
|
//
|
184
|
184
|
// Round the start and end locations to produce full lines of output
|
185
|
185
|
//
|
186
|
|
- start = (char*)((ptr_int_t)((uint32_t)start & 0xFFFFFFF0)); // Align to 16-byte boundary
|
187
|
|
- end = (char*)((ptr_int_t)((uint32_t)end | 0x0000000F)); // Align end_free_memory to the 15th byte (at or above end_free_memory)
|
188
|
|
- dump_free_memory(start, end);
|
|
186
|
+ dump_free_memory(
|
|
187
|
+ (char*)(ptr_int_t(uint32_t(start) & ~0xFUL)), // Align to 16-byte boundary
|
|
188
|
+ (char*)(ptr_int_t(uint32_t(end) | 0xFUL)) // Align end_free_memory to the 15th byte (at or above end_free_memory)
|
|
189
|
+ );
|
189
|
190
|
}
|
190
|
191
|
|
191
|
192
|
#endif // M100_FREE_MEMORY_DUMPER
|
|
@@ -211,7 +212,7 @@ inline int check_for_free_memory_corruption(PGM_P const title) {
|
211
|
212
|
// idle();
|
212
|
213
|
serial_delay(20);
|
213
|
214
|
#if ENABLED(M100_FREE_MEMORY_DUMPER)
|
214
|
|
- M100_dump_routine(PSTR(" Memory corruption detected with end_free_memory<Heap\n"), (char*)0x1B80, (char*)0x21FF);
|
|
215
|
+ M100_dump_routine(PSTR(" Memory corruption detected with end_free_memory<Heap\n"), (const char*)0x1B80, (const char*)0x21FF);
|
215
|
216
|
#endif
|
216
|
217
|
}
|
217
|
218
|
|