#include #include "wm_hal.h" #define X_MAX 79 #define Y_MAX 25 uint8_t result[Y_MAX][X_MAX]; void display_result(void) { int x, y; const char c[] = "0123456789ABCDEF "; for (y = 0; y < Y_MAX; y++) { for (x = 0; x < X_MAX; x++) { putchar(c[result[y][x]]); } putchar('\n'); } } void benchmark(void) { int x, y, i; float a, b, ca, cb, t; for (y = -12; y <= 12; y++) { for (x = -39; x <= 39; x++) { a = ca = x * 0.0458; b = cb = y * 0.08333; for (i = 0; i <= 15; i++) { t = (a * a) - (b * b) + ca; b = (2 * a * b) + cb; a = t; if ((a * a + b * b) > 4) break; } result[y + 12][x + 39] = i; } } return; } int main(void) { SystemClock_Config(CPU_CLK_40M); // 2M did not work? printf("enter main\n"); benchmark(); display_result(); printf("exit main\n"); while (1); } /* SystemClock_Config() requires this handler, do not forget -mistack */ __attribute__((isr)) void CORET_IRQHandler(void) { (void)*(volatile unsigned int *)0xe000e010; HAL_IncTick(); }