atmel-samd: Update the Micro Trace Buffer to have better defines.
Same as README.md here: https://github.com/adafruit/gdb-micro-trace-buffer
This commit is contained in:
parent
90bf13efd5
commit
42f6ba04a2
@ -271,8 +271,14 @@ void MP_WEAK __assert_func(const char *file, int line, const char *func, const c
|
|||||||
struct usart_module usart_instance;
|
struct usart_module usart_instance;
|
||||||
|
|
||||||
#ifdef ENABLE_MICRO_TRACE_BUFFER
|
#ifdef ENABLE_MICRO_TRACE_BUFFER
|
||||||
#define TRACE_BUFFER_SIZE 256
|
// Stores 2 ^ TRACE_BUFFER_MAGNITUDE_PACKETS packets.
|
||||||
__attribute__((__aligned__(TRACE_BUFFER_SIZE * sizeof(uint32_t)))) uint32_t mtb[TRACE_BUFFER_SIZE];
|
// 7 -> 128 packets
|
||||||
|
#define TRACE_BUFFER_MAGNITUDE_PACKETS 7
|
||||||
|
// Size in uint32_t. Two per packet.
|
||||||
|
#define TRACE_BUFFER_SIZE (1 << (TRACE_BUFFER_MAGNITUDE_PACKETS + 1))
|
||||||
|
// Size in bytes. 4 bytes per uint32_t.
|
||||||
|
#define TRACE_BUFFER_SIZE_BYTES (TRACE_BUFFER_SIZE << 2)
|
||||||
|
__attribute__((__aligned__(TRACE_BUFFER_SIZE_BYTES))) uint32_t mtb[TRACE_BUFFER_SIZE];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Serial number as hex characters.
|
// Serial number as hex characters.
|
||||||
@ -292,11 +298,9 @@ void load_serial_number(void) {
|
|||||||
|
|
||||||
void samd21_init(void) {
|
void samd21_init(void) {
|
||||||
#ifdef ENABLE_MICRO_TRACE_BUFFER
|
#ifdef ENABLE_MICRO_TRACE_BUFFER
|
||||||
memset(mtb, 0, sizeof(mtb));
|
|
||||||
// AWIDTH is 15.
|
|
||||||
REG_MTB_POSITION = ((uint32_t) (mtb - REG_MTB_BASE)) & 0xFFFFFFF8;
|
REG_MTB_POSITION = ((uint32_t) (mtb - REG_MTB_BASE)) & 0xFFFFFFF8;
|
||||||
REG_MTB_FLOW = ((uint32_t) mtb + TRACE_BUFFER_SIZE * sizeof(uint32_t)) & 0xFFFFFFF8;
|
REG_MTB_FLOW = (((uint32_t) mtb - REG_MTB_BASE) + TRACE_BUFFER_SIZE_BYTES) & 0xFFFFFFF8;
|
||||||
REG_MTB_MASTER = 0x80000000 + 6;
|
REG_MTB_MASTER = 0x80000000 + (TRACE_BUFFER_MAGNITUDE_PACKETS - 1);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
load_serial_number();
|
load_serial_number();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user