Skip to content

Commit dff8112

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 52614b4 + 0019306 commit dff8112

File tree

17 files changed

+157
-136
lines changed

17 files changed

+157
-136
lines changed

boards.txt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ feather52832.menu.debug.l2=Level 2 (Full Debug)
6060
feather52832.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
6161
feather52832.menu.debug.l3=Level 3 (Segger SystemView)
6262
feather52832.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
63+
feather52832.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
6364

6465
# ----------------------------------
6566
# Bluefruit Feather nRF52840 Express
@@ -113,6 +114,7 @@ feather52840.menu.debug.l2=Level 2 (Full Debug)
113114
feather52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
114115
feather52840.menu.debug.l3=Level 3 (Segger SystemView)
115116
feather52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
117+
feather52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
116118

117119

118120
# ----------------------------------
@@ -167,6 +169,7 @@ feather52840sense.menu.debug.l2=Level 2 (Full Debug)
167169
feather52840sense.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
168170
feather52840sense.menu.debug.l3=Level 3 (Segger SystemView)
169171
feather52840sense.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
172+
feather52840sense.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
170173

171174

172175
# ---------------------------------------------
@@ -221,6 +224,7 @@ itsybitsy52840.menu.debug.l2=Level 2 (Full Debug)
221224
itsybitsy52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
222225
itsybitsy52840.menu.debug.l3=Level 3 (Segger SystemView)
223226
itsybitsy52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
227+
itsybitsy52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
224228

225229
# ---------------------------------------------
226230
# Bluefruit Circuit Playground nRF52840 Express
@@ -274,6 +278,7 @@ cplaynrf52840.menu.debug.l2=Level 2 (Full Debug)
274278
cplaynrf52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
275279
cplaynrf52840.menu.debug.l3=Level 3 (Segger SystemView)
276280
cplaynrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
281+
cplaynrf52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
277282

278283

279284
# ---------------------------------------------
@@ -298,7 +303,7 @@ cluenrf52840.upload.protocol=nrfutil
298303
cluenrf52840.upload.use_1200bps_touch=true
299304
cluenrf52840.upload.wait_for_upload_port=true
300305
cluenrf52840.upload.maximum_size=815104
301-
cluenrf52840.upload.maximum_data_size=248832
306+
cluenrf52840.upload.maximum_data_size=237568
302307

303308
# Build
304309
cluenrf52840.build.mcu=cortex-m4
@@ -328,6 +333,7 @@ cluenrf52840.menu.debug.l2=Level 2 (Full Debug)
328333
cluenrf52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
329334
cluenrf52840.menu.debug.l3=Level 3 (Segger SystemView)
330335
cluenrf52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
336+
cluenrf52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
331337

332338
# ----------------------------------
333339
# Bluefruit Metro nRF52840 Express
@@ -381,6 +387,7 @@ metro52840.menu.debug.l2=Level 2 (Full Debug)
381387
metro52840.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
382388
metro52840.menu.debug.l3=Level 3 (Segger SystemView)
383389
metro52840.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
390+
metro52840.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
384391

385392

386393

@@ -434,6 +441,7 @@ pca10056.menu.debug.l2=Level 2 (Full Debug)
434441
pca10056.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
435442
pca10056.menu.debug.l3=Level 3 (Segger SystemView)
436443
pca10056.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
444+
pca10056.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
437445

438446
# ----------------------------------
439447
# Particle Xenon
@@ -457,7 +465,7 @@ particle_xenon.upload.protocol=nrfutil
457465
particle_xenon.upload.use_1200bps_touch=true
458466
particle_xenon.upload.wait_for_upload_port=true
459467
particle_xenon.upload.maximum_size=815104
460-
particle_xenon.upload.maximum_data_size=248832
468+
particle_xenon.upload.maximum_data_size=237568
461469

462470
# Build
463471
particle_xenon.build.mcu=cortex-m4
@@ -487,6 +495,7 @@ particle_xenon.menu.debug.l2=Level 2 (Full Debug)
487495
particle_xenon.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
488496
particle_xenon.menu.debug.l3=Level 3 (Segger SystemView)
489497
particle_xenon.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
498+
particle_xenon.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1
490499

491500
# ----------------------------------
492501
# Raytac MDBT50Q - RX
@@ -510,7 +519,7 @@ mdbt50qrx.upload.protocol=nrfutil
510519
mdbt50qrx.upload.use_1200bps_touch=true
511520
mdbt50qrx.upload.wait_for_upload_port=true
512521
mdbt50qrx.upload.maximum_size=815104
513-
mdbt50qrx.upload.maximum_data_size=248832
522+
mdbt50qrx.upload.maximum_data_size=237568
514523

515524
# Build
516525
mdbt50qrx.build.mcu=cortex-m4
@@ -540,3 +549,4 @@ mdbt50qrx.menu.debug.l2=Level 2 (Full Debug)
540549
mdbt50qrx.menu.debug.l2.build.debug_flags=-DCFG_DEBUG=2
541550
mdbt50qrx.menu.debug.l3=Level 3 (Segger SystemView)
542551
mdbt50qrx.menu.debug.l3.build.debug_flags=-DCFG_DEBUG=3
552+
mdbt50qrx.menu.debug.l3.build.sysview_flags=-DCFG_SYSVIEW=1

cores/nRF5/WInterrupts.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ void detachInterrupt(uint32_t pin)
144144

145145
void GPIOTE_IRQHandler()
146146
{
147-
#if CFG_DEBUG >= 3
147+
#if CFG_SYSVIEW
148148
SEGGER_SYSVIEW_RecordEnterISR();
149149
#endif
150150

@@ -171,7 +171,7 @@ void GPIOTE_IRQHandler()
171171
event = (uint32_t)((uint32_t)event + 4);
172172
}
173173

174-
#if CFG_DEBUG >= 3
174+
#if CFG_SYSVIEW
175175
SEGGER_SYSVIEW_RecordExitISR();
176176
#endif
177177
}

cores/nRF5/common_func.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@
116116
//--------------------------------------------------------------------+
117117
const char* dbg_err_str(int32_t err_id); // TODO move to other place
118118

119+
#if __cplusplus
120+
#define PRINTF ::printf
121+
#else
122+
#define PRINTF printf
123+
#endif
124+
125+
119126
#if CFG_DEBUG
120127
#define LOG_LV1(...) ADALOG(__VA_ARGS__)
121128
#define LOG_LV1_BUFFER(...) ADALOG_BUFFER(__VA_ARGS__)
@@ -134,15 +141,9 @@ const char* dbg_err_str(int32_t err_id); // TODO move to other place
134141

135142
#if CFG_DEBUG
136143

137-
#if __cplusplus
138-
#define PRINTF ::printf
139-
#else
140-
#define PRINTF printf
141-
#endif
142-
143144
#define PRINT_LOCATION() PRINTF("%s: %d:\n", __PRETTY_FUNCTION__, __LINE__)
144145
#define PRINT_MESS(x) PRINTF("%s: %d: %s \n" , __FUNCTION__, __LINE__, (char*)(x))
145-
#define PRTNT_HEAP() if (CFG_DEBUG == 3) PRINTF("\n%s: %d: Heap free: %d\n", __FUNCTION__, __LINE__, util_heap_get_free_size())
146+
#define PRTNT_HEAP() if (CFG_DEBUG >= 3) PRINTF("\n%s: %d: Heap free: %d\n", __FUNCTION__, __LINE__, util_heap_get_free_size())
146147
#define PRINT_STR(x) PRINTF("%s: %d: " #x " = %s\n" , __FUNCTION__, __LINE__, (char*)(x) )
147148
#define PRINT_INT(x) PRINTF("%s: %d: " #x " = %ld\n" , __FUNCTION__, __LINE__, (uint32_t) (x) )
148149
#define PRINT_FLOAT(x) PRINTF("%s: %d: " #x " = %f\n" , __FUNCTION__, __LINE__, (float) (x) )

cores/nRF5/common_inc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
#include <stdbool.h>
4141

4242
#include "compiler_macro.h"
43-
#include "verify.h"
4443
#include "common_func.h"
44+
#include "verify.h"
4545

4646
#endif /* COMMON_INC_H_ */

cores/nRF5/freertos/config/FreeRTOSConfig.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ standard names - or at least those used in the unmodified vector table. */
196196
*/
197197
#define configUSE_DISABLE_TICK_AUTO_CORRECTION_DEBUG 0
198198

199-
// Sysview require at least debug level 3
200-
#if CFG_DEBUG >= 3
199+
// Sysview is enabled by default at debug level 3
200+
#if CFG_SYSVIEW
201201
#include "sysview/SEGGER_SYSVIEW_FreeRTOS.h"
202202
#endif
203203

cores/nRF5/main.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ void Bluefruit_printInfo() __attribute__((weak));
2424
void Bluefruit_printInfo() {}
2525
#endif
2626

27-
// DEBUG Level 3
28-
#if CFG_DEBUG >= 3
27+
// From the UI, setting debug level to 3 will enable SysView
28+
#if CFG_SYSVIEW
2929
#include "SEGGER_SYSVIEW.h"
3030
#endif
3131

@@ -80,7 +80,7 @@ int main( void )
8080
Adafruit_TinyUSB_Core_init();
8181
#endif
8282

83-
#if CFG_DEBUG >= 3
83+
#if CFG_SYSVIEW
8484
SEGGER_SYSVIEW_Conf();
8585
#endif
8686

cores/nRF5/sysview/SEGGER_SYSVIEW_FreeRTOS.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Purpose : Interface between FreeRTOS and SystemView.
5252
Revision: $Rev: 7947 $
5353
*/
5454

55-
#if CFG_DEBUG >= 3
55+
#if CFG_SYSVIEW
5656

5757
#include "FreeRTOS.h"
5858
#include "task.h"
@@ -252,6 +252,6 @@ const SEGGER_SYSVIEW_OS_API SYSVIEW_X_OS_TraceAPI = {
252252
_cbSendTaskList,
253253
};
254254

255-
#endif // CFG_DEBUG >= 3
255+
#endif // CFG_SYSVIEW
256256

257257
/*************************** End of file ****************************/

cores/nRF5/utility/debug.cpp

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include <malloc.h>
4040
#include <Arduino.h>
4141
#include <ctype.h>
42+
#include <common_func.h>
4243

4344
// defined in linker script
4445
extern uint32_t __data_start__[];
@@ -106,14 +107,14 @@ static void printMemRegion(const char* name, uint32_t top, uint32_t bottom, uint
106107
sprintf(buffer, "%lu", top-bottom);
107108
}
108109

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

112113
void dbgMemInfo(void)
113114
{
114-
printf(" ______________________________________________\n");
115-
printf("| Name | Addr 0x2000xxxx | Usage |\n");
116-
printf("| ---------------------------------------------|\n");
115+
PRINTF(" ______________________________________________\n");
116+
PRINTF("| Name | Addr 0x2000xxxx | Usage |\n");
117+
PRINTF("| ---------------------------------------------|\n");
117118

118119
// Pritn SRAM used for Stack executed by Softdevice and ISR
119120
printMemRegion("Stack", ((uint32_t) __StackTop), ((uint32_t) __StackLimit), dbgStackUsed() );
@@ -127,29 +128,29 @@ void dbgMemInfo(void)
127128
// Print SRAM Used by SoftDevice
128129
printMemRegion("SD", (uint32_t) __data_start__, 0x20000000, 0);
129130

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

133134
// Print Task list
134135
uint32_t tasknum = uxTaskGetNumberOfTasks();
135136
char* buf = (char*) rtos_malloc(tasknum*40); // 40 bytes per task
136137

137138
vTaskList(buf);
138139

139-
printf("Task State Prio StackLeft Num\n");
140-
printf("-----------------------------------\n");
141-
printf(buf);
142-
printf("\n");
140+
PRINTF("Task State Prio StackLeft Num\n");
141+
PRINTF("-----------------------------------\n");
142+
PRINTF(buf);
143+
PRINTF("\n");
143144
rtos_free(buf);
144145
}
145146

146147
void dbgPrintVersion(void)
147148
{
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");
149+
PRINTF("\n");
150+
PRINTF("BSP Library : " ARDUINO_BSP_VERSION "\n");
151+
PRINTF("Bootloader : %s\n", getBootloaderVersion());
152+
PRINTF("Serial No : %s\n", getMcuUniqueID());
153+
PRINTF("\n");
153154
}
154155

155156
/******************************************************************************/
@@ -163,15 +164,15 @@ static void dump_str_line(uint8_t const* buf, uint16_t count)
163164
for(int i=0; i<count; i++)
164165
{
165166
const char ch = buf[i];
166-
printf("%c", isprint(ch) ? ch : '.');
167+
PRINTF("%c", isprint(ch) ? ch : '.');
167168
}
168169
}
169170

170171
void dbgDumpMemory(void const *buf, uint8_t size, uint16_t count, bool printOffset)
171172
{
172173
if ( !buf || !count )
173174
{
174-
printf("NULL\n");
175+
PRINTF("NULL\n");
175176
return;
176177
}
177178

@@ -191,26 +192,26 @@ void dbgDumpMemory(void const *buf, uint8_t size, uint16_t count, bool printOffs
191192
// Print Ascii
192193
if ( i != 0 )
193194
{
194-
printf(" | ");
195+
PRINTF(" | ");
195196
dump_str_line(buf8-16, 16);
196-
printf("\n");
197+
PRINTF("\n");
197198
}
198199

199200
// print offset or absolute address
200201
if (printOffset)
201202
{
202-
printf("%03lX: ", 16*i/item_per_line);
203+
PRINTF("%03lX: ", 16*i/item_per_line);
203204
}else
204205
{
205-
printf("%08lX:", (uint32_t) buf8);
206+
PRINTF("%08lX:", (uint32_t) buf8);
206207
}
207208
}
208209

209210
memcpy(&value, buf8, size);
210211
buf8 += size;
211212

212-
printf(" ");
213-
printf(format, value);
213+
PRINTF(" ");
214+
PRINTF(format, value);
214215
}
215216

216217
// fill up last row to 16 for printing ascii
@@ -221,46 +222,46 @@ void dbgDumpMemory(void const *buf, uint8_t size, uint16_t count, bool printOffs
221222
{
222223
for(int i=0; i< 16-remain; i++)
223224
{
224-
printf(" ");
225-
for(int j=0; j<2*size; j++) printf(" ");
225+
PRINTF(" ");
226+
for(int j=0; j<2*size; j++) PRINTF(" ");
226227
}
227228
}
228229

229-
printf(" | ");
230+
PRINTF(" | ");
230231
dump_str_line(buf8-nback, nback);
231-
printf("\n");
232+
PRINTF("\n");
232233

233-
printf("\n");
234+
PRINTF("\n");
234235
}
235236

236237

237238
void dbgDumpMemoryCFormat(const char* str, void const *buf, uint16_t count)
238239
{
239240
if ( !buf )
240241
{
241-
printf("NULL\n");
242+
PRINTF("NULL\n");
242243
return;
243244
}
244245

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

247248
uint8_t const *buf8 = (uint8_t const *) buf;
248249

249250
for(uint32_t i=0; i<count; i++)
250251
{
251252
if ( i%16 == 0 )
252253
{
253-
if ( i != 0 ) printf(",\n ");
254+
if ( i != 0 ) PRINTF(",\n ");
254255
}else
255256
{
256-
if ( i != 0 ) printf(", ");
257+
if ( i != 0 ) PRINTF(", ");
257258
}
258259

259-
printf("0x%02X", *buf8);
260+
PRINTF("0x%02X", *buf8);
260261
buf8++;
261262
}
262263

263-
printf("\n};\n");
264+
PRINTF("\n};\n");
264265
}
265266

266267

0 commit comments

Comments
 (0)