|
@@ -86,7 +86,6 @@ int16_t count_test_bytes(const uint8_t * const ptr) {
|
86
|
86
|
return -1;
|
87
|
87
|
}
|
88
|
88
|
|
89
|
|
-
|
90
|
89
|
//
|
91
|
90
|
// M100 sub-commands
|
92
|
91
|
//
|
|
@@ -172,7 +171,7 @@ void free_memory_pool_report(const char * const ptr, const uint16_t size) {
|
172
|
171
|
const uint16_t j = count_test_bytes(addr);
|
173
|
172
|
if (j > 8) {
|
174
|
173
|
SERIAL_ECHOPAIR("Found ", j);
|
175
|
|
- SERIAL_ECHOLNPAIR(" bytes free at 0x", hex_word((uint16_t)addr));
|
|
174
|
+ SERIAL_ECHOLNPAIR(" bytes free at ", hex_address(addr));
|
176
|
175
|
if (j > max_cnt) {
|
177
|
176
|
max_cnt = j;
|
178
|
177
|
max_addr = addr;
|
|
@@ -185,7 +184,7 @@ void free_memory_pool_report(const char * const ptr, const uint16_t size) {
|
185
|
184
|
if (block_cnt > 1) {
|
186
|
185
|
SERIAL_ECHOLNPGM("\nMemory Corruption detected in free memory area.");
|
187
|
186
|
SERIAL_ECHOPAIR("\nLargest free block is ", max_cnt);
|
188
|
|
- SERIAL_ECHOLNPAIR(" bytes at 0x", hex_word((uint16_t)max_addr));
|
|
187
|
+ SERIAL_ECHOLNPAIR(" bytes at ", hex_address(max_addr));
|
189
|
188
|
}
|
190
|
189
|
SERIAL_ECHOLNPAIR("check_for_free_memory_corruption() = ", check_for_free_memory_corruption("M100 F "));
|
191
|
190
|
}
|
|
@@ -206,7 +205,7 @@ void free_memory_pool_report(const char * const ptr, const uint16_t size) {
|
206
|
205
|
for (uint16_t i = 1; i <= size; i++) {
|
207
|
206
|
char * const addr = ptr + i * j;
|
208
|
207
|
*addr = i;
|
209
|
|
- SERIAL_ECHOPAIR("\nCorrupting address: 0x", hex_word((uint16_t)addr));
|
|
208
|
+ SERIAL_ECHOPAIR("\nCorrupting address: ", hex_address(addr));
|
210
|
209
|
}
|
211
|
210
|
SERIAL_EOL;
|
212
|
211
|
}
|
|
@@ -235,8 +234,9 @@ void init_free_memory(uint8_t *ptr, int16_t size) {
|
235
|
234
|
|
236
|
235
|
for (uint16_t i = 0; i < size; i++) {
|
237
|
236
|
if (((char) ptr[i]) != TEST_BYTE) {
|
238
|
|
- SERIAL_ECHOPAIR("? address : 0x", hex_word((uint16_t)ptr + i));
|
239
|
|
- SERIAL_ECHOLNPAIR("=", hex_byte(ptr[i]));
|
|
237
|
+ SERIAL_ECHOPAIR("? address : ", hex_address(ptr + i));
|
|
238
|
+ SERIAL_ECHOPAIR("=", hex_byte(ptr[i]));
|
|
239
|
+ SERIAL_EOL; SERIAL_EOL;
|
240
|
240
|
}
|
241
|
241
|
}
|
242
|
242
|
}
|
|
@@ -245,13 +245,13 @@ void init_free_memory(uint8_t *ptr, int16_t size) {
|
245
|
245
|
* M100: Free Memory Check
|
246
|
246
|
*/
|
247
|
247
|
void gcode_M100() {
|
248
|
|
- SERIAL_ECHOPAIR("\n__brkval : 0x", hex_word((uint16_t)__brkval));
|
249
|
|
- SERIAL_ECHOPAIR("\n__bss_end: 0x", hex_word((uint16_t)&__bss_end));
|
|
248
|
+ SERIAL_ECHOPAIR("\n__brkval : ", hex_address(__brkval));
|
|
249
|
+ SERIAL_ECHOPAIR("\n__bss_end : ", hex_address(&__bss_end));
|
250
|
250
|
|
251
|
251
|
uint8_t *ptr = END_OF_HEAP(), *sp = top_of_stack();
|
252
|
252
|
|
253
|
|
- SERIAL_ECHOPAIR("\nstart of free space : 0x", hex_word((uint16_t)ptr));
|
254
|
|
- SERIAL_ECHOLNPAIR("\nStack Pointer : 0x", hex_word((uint16_t)sp));
|
|
253
|
+ SERIAL_ECHOPAIR("\nstart of free space : ", hex_address(ptr));
|
|
254
|
+ SERIAL_ECHOLNPAIR("\nStack Pointer : ", hex_address(sp));
|
255
|
255
|
|
256
|
256
|
// Always init on the first invocation of M100
|
257
|
257
|
static bool m100_not_initialized = true;
|
|
@@ -287,9 +287,9 @@ int check_for_free_memory_corruption(char *title) {
|
287
|
287
|
|
288
|
288
|
n = sp - ptr;
|
289
|
289
|
SERIAL_ECHOPAIR("\nfmc() n=", n);
|
290
|
|
- SERIAL_ECHOPAIR("\n&__brkval: 0x", hex_word((uint16_t)&__brkval));
|
291
|
|
- SERIAL_ECHOPAIR("=0x", hex_word((uint16_t)__brkval));
|
292
|
|
- SERIAL_ECHOPAIR("\n__bss_end: 0x", hex_word((uint16_t)&__bss_end));
|
|
290
|
+ SERIAL_ECHOPAIR("\n&__brkval: ", hex_address(&__brkval));
|
|
291
|
+ SERIAL_ECHOPAIR("=", hex_address(__brkval));
|
|
292
|
+ SERIAL_ECHOPAIR("\n__bss_end: ", hex_address(&__bss_end));
|
293
|
293
|
SERIAL_ECHOPAIR(" sp=", hex_word(sp));
|
294
|
294
|
|
295
|
295
|
if (sp < ptr) {
|