<commit_before>#include "common.h"

#include "control.h"
#include "blink.h"
#include "interrupt.h"
#include "drivers.h"

uint8_t g_error_last __attribute__ ((section (".noinit"))); // do not zero out on reset

void dump_stack() //{{{
{
	uint8_t* sp = (uint8_t*)(SP + 1);
	uint16_t i;

	printf("Stack dump notes:                                              \n\
		1. 3 bytes for each return address                                   \n\
		2. return addresses must be multiplied by 2 to compare with disasm   \n\
	");

	for (i = 0; i < 50; i++)
	{
		printf("%02X ", sp[i]);
	}
	printf("\n");
} //}}}

void inline halt(uint8_t code) //{{{
{
	interrupt_disable();

	// remember last error
	g_error_last = code;

	printf("HALT %u\n", code);

	dump_stack();

	reset();
} //}}}
<commit_msg>Added buffer printing for debugging.<commit_after>#include "common.h"

#include "control.h"
#include "blink.h"
#include "interrupt.h"
#include "drivers.h"

uint8_t g_error_last __attribute__ ((section (".noinit"))); // do not zero out on reset

void dump_stack() //{{{
{
	uint8_t* sp = (uint8_t*)(SP + 1);
	uint16_t i;

	printf("Stack dump notes:                                              \n\
		1. 3 bytes for each return address                                   \n\
		2. return addresses must be multiplied by 2 to compare with disasm   \n\
	");

	for (i = 0; i < 50; i++)
	{
		printf("%02X ", sp[i]);
	}
	printf("\n");
} //}}}

void inline halt(uint8_t code) //{{{
{
	interrupt_disable();

	// remember last error
	g_error_last = code;

	printf("HALT %u\n", code);

	dump_stack();

	reset();
} //}}}

void print_buffer(uint8_t* buf, uint16_t len) //{{{
{
	uint16_t i;
	printf("[");
	for (i = 0; i < len; i++)
		printf(" %02X", buf[i]);
	printf(" ]");
} //}}}
{'fraction_non_alphanumeric': 0.17916428162564396, 'fraction_numerical': 0.02289639381797367, 'mean_word_length': 2.4074074074074074, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3037103', 'n_tokens_mistral': 674, 'n_tokens_neox': 630, 'n_words': 178}