Files
wch-uf2-example/minimal-payload/main.c
T
R 40082ed533 Minimal executable, cleaned up from vendor code
- Removed extraneous and/or oversized(?) align from linker script
- Handle init_array properly
- Remove legacy init code paths (.ctors, .init)
- Don't do nonstandard interrupt mode handling by default
2024-04-12 17:50:23 +01:00

26 lines
514 B
C

int test = 0x12345;
int test2;
#pragma GCC diagnostic ignored "-Wprio-ctor-dtor"
__attribute__((constructor(0))) static void setup_qingke() {
asm volatile(
// Undocumented "Configure pipelining and instruction prediction"
"li t0, 0x1f\n"
"csrw 0xbc0, t0\n"
);
}
__attribute__((constructor)) static void constructor() {
test2 = 0x5678;
}
__attribute__((destructor)) static void destructor() {
test2 = 0x9abc;
}
int main(void) {
test++;
test2--;
return 123;
}