Skip to content

Commit 4565d0c

Browse files
committed
Use uppercase PRINTF.
This is a step in preparation for the ability to change the default handler for printf(), such as when advanced debug output capabilities make it more performant to output via an alternative route.
1 parent 64b05d3 commit 4565d0c

File tree

3 files changed

+41
-41
lines changed

3 files changed

+41
-41
lines changed

cores/nRF5/utility/debug.cpp

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,14 @@ static void printMemRegion(const char* name, uint32_t top, uint32_t bottom, uint
106106
sprintf(buffer, "%lu", top-bottom);
107107
}
108108

109-
printf("| %-5s| 0x%04X - 0x%04X | %-19s |\n", name, (uint16_t) bottom, (uint16_t) (top-1), buffer);
109+
PRINTF("| %-5s| 0x%04X - 0x%04X | %-19s |\n", name, (uint16_t) bottom, (uint16_t) (top-1), buffer);
110110
}
111111

112112
void dbgMemInfo(void)
113113
{
114-
printf(" ______________________________________________\n");
115-
printf("| Name | Addr 0x2000xxxx | Usage |\n");
116-
printf("| ---------------------------------------------|\n");
114+
PRINTF(" ______________________________________________\n");
115+
PRINTF("| Name | Addr 0x2000xxxx | Usage |\n");
116+
PRINTF("| ---------------------------------------------|\n");
117117

118118
// Pritn SRAM used for Stack executed by Softdevice and ISR
119119
printMemRegion("Stack", ((uint32_t) __StackTop), ((uint32_t) __StackLimit), dbgStackUsed() );
@@ -127,29 +127,29 @@ void dbgMemInfo(void)
127127
// Print SRAM Used by SoftDevice
128128
printMemRegion("SD", (uint32_t) __data_start__, 0x20000000, 0);
129129

130-
printf("|______________________________________________|\n");
131-
printf("\n");
130+
PRINTF("|______________________________________________|\n");
131+
PRINTF("\n");
132132

133133
// Print Task list
134134
uint32_t tasknum = uxTaskGetNumberOfTasks();
135135
char* buf = (char*) rtos_malloc(tasknum*40); // 40 bytes per task
136136

137137
vTaskList(buf);
138138

139-
printf("Task State Prio StackLeft Num\n");
140-
printf("-----------------------------------\n");
141-
printf(buf);
142-
printf("\n");
139+
PRINTF("Task State Prio StackLeft Num\n");
140+
PRINTF("-----------------------------------\n");
141+
PRINTF(buf);
142+
PRINTF("\n");
143143
rtos_free(buf);
144144
}
145145

146146
void dbgPrintVersion(void)
147147
{
148-
printf("\n");
149-
printf("BSP Library : " ARDUINO_BSP_VERSION "\n");
150-
printf("Bootloader : %s\n", getBootloaderVersion());
151-
printf("Serial No : %s\n", getMcuUniqueID());
152-
printf("\n");
148+
PRINTF("\n");
149+
PRINTF("BSP Library : " ARDUINO_BSP_VERSION "\n");
150+
PRINTF("Bootloader : %s\n", getBootloaderVersion());
151+
PRINTF("Serial No : %s\n", getMcuUniqueID());
152+
PRINTF("\n");
153153
}
154154

155155
/******************************************************************************/
@@ -163,15 +163,15 @@ static void dump_str_line(uint8_t const* buf, uint16_t count)
163163
for(int i=0; i<count; i++)
164164
{
165165
const char ch = buf[i];
166-
printf("%c", isprint(ch) ? ch : '.');
166+
PRINTF("%c", isprint(ch) ? ch : '.');
167167
}
168168
}
169169

170170
void dbgDumpMemory(void const *buf, uint8_t size, uint16_t count, bool printOffset)
171171
{
172172
if ( !buf || !count )
173173
{
174-
printf("NULL\n");
174+
PRINTF("NULL\n");
175175
return;
176176
}
177177

@@ -191,26 +191,26 @@ void dbgDumpMemory(void const *buf, uint8_t size, uint16_t count, bool printOffs
191191
// Print Ascii
192192
if ( i != 0 )
193193
{
194-
printf(" | ");
194+
PRINTF(" | ");
195195
dump_str_line(buf8-16, 16);
196-
printf("\n");
196+
PRINTF("\n");
197197
}
198198

199199
// print offset or absolute address
200200
if (printOffset)
201201
{
202-
printf("%03lX: ", 16*i/item_per_line);
202+
PRINTF("%03lX: ", 16*i/item_per_line);
203203
}else
204204
{
205-
printf("%08lX:", (uint32_t) buf8);
205+
PRINTF("%08lX:", (uint32_t) buf8);
206206
}
207207
}
208208

209209
memcpy(&value, buf8, size);
210210
buf8 += size;
211211

212-
printf(" ");
213-
printf(format, value);
212+
PRINTF(" ");
213+
PRINTF(format, value);
214214
}
215215

216216
// fill up last row to 16 for printing ascii
@@ -221,46 +221,46 @@ void dbgDumpMemory(void const *buf, uint8_t size, uint16_t count, bool printOffs
221221
{
222222
for(int i=0; i< 16-remain; i++)
223223
{
224-
printf(" ");
225-
for(int j=0; j<2*size; j++) printf(" ");
224+
PRINTF(" ");
225+
for(int j=0; j<2*size; j++) PRINTF(" ");
226226
}
227227
}
228228

229-
printf(" | ");
229+
PRINTF(" | ");
230230
dump_str_line(buf8-nback, nback);
231-
printf("\n");
231+
PRINTF("\n");
232232

233-
printf("\n");
233+
PRINTF("\n");
234234
}
235235

236236

237237
void dbgDumpMemoryCFormat(const char* str, void const *buf, uint16_t count)
238238
{
239239
if ( !buf )
240240
{
241-
printf("NULL\n");
241+
PRINTF("NULL\n");
242242
return;
243243
}
244244

245-
printf("%s = \n{\n ", str);
245+
PRINTF("%s = \n{\n ", str);
246246

247247
uint8_t const *buf8 = (uint8_t const *) buf;
248248

249249
for(uint32_t i=0; i<count; i++)
250250
{
251251
if ( i%16 == 0 )
252252
{
253-
if ( i != 0 ) printf(",\n ");
253+
if ( i != 0 ) PRINTF(",\n ");
254254
}else
255255
{
256-
if ( i != 0 ) printf(", ");
256+
if ( i != 0 ) PRINTF(", ");
257257
}
258258

259-
printf("0x%02X", *buf8);
259+
PRINTF("0x%02X", *buf8);
260260
buf8++;
261261
}
262262

263-
printf("\n};\n");
263+
PRINTF("\n};\n");
264264
}
265265

266266

cores/nRF5/verify.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,16 @@ extern "C"
6060
#define VERIFY_MESS(_status, _functstr) VERIFY_MESS_impl(_status, _functstr, __PRETTY_FUNCTION__, __LINE__)
6161
static inline void VERIFY_MESS_impl(int32_t _status, const char* (*_fstr)(int32_t), const char* func_name, int line_number)
6262
{
63-
printf("%s: %d: verify failed, error = ", func_name, line_number);
63+
PRINTF("%s: %d: verify failed, error = ", func_name, line_number);
6464
if (_fstr)
6565
{
66-
printf(_fstr(_status));
66+
PRINTF(_fstr(_status));
6767
}
6868
else
6969
{
70-
printf("%ld", _status);
70+
PRINTF("%ld", _status);
7171
}
72-
printf("\n");
72+
PRINTF("\n");
7373
}
7474
#else
7575
#define VERIFY_MESS(_status, _funcstr)

libraries/Adafruit_LittleFS/src/littlefs/lfs_util.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,21 @@ extern "C"
5656
// Logging functions
5757
#ifndef LFS_NO_DEBUG
5858
#define LFS_DEBUG(fmt, ...) \
59-
printf("lfs debug:%d: " fmt "\n", __LINE__, __VA_ARGS__)
59+
PRINTF("lfs debug:%d: " fmt "\n", __LINE__, __VA_ARGS__)
6060
#else
6161
#define LFS_DEBUG(fmt, ...)
6262
#endif
6363

6464
#ifndef LFS_NO_WARN
6565
#define LFS_WARN(fmt, ...) \
66-
printf("lfs warn:%d: " fmt "\n", __LINE__, __VA_ARGS__)
66+
PRINTF("lfs warn:%d: " fmt "\n", __LINE__, __VA_ARGS__)
6767
#else
6868
#define LFS_WARN(fmt, ...)
6969
#endif
7070

7171
#ifndef LFS_NO_ERROR
7272
#define LFS_ERROR(fmt, ...) \
73-
printf("lfs error:%d: " fmt "\n", __LINE__, __VA_ARGS__)
73+
PRINTF("lfs error:%d: " fmt "\n", __LINE__, __VA_ARGS__)
7474
#else
7575
#define LFS_ERROR(fmt, ...)
7676
#endif

0 commit comments

Comments
 (0)