Replace demo program with blinky
This commit is contained in:
+14
-12
@@ -1,5 +1,4 @@
|
|||||||
int test = 0x12345;
|
#include <stdint.h>
|
||||||
int test2;
|
|
||||||
|
|
||||||
#pragma GCC diagnostic ignored "-Wprio-ctor-dtor"
|
#pragma GCC diagnostic ignored "-Wprio-ctor-dtor"
|
||||||
__attribute__((constructor(0))) static void setup_qingke() {
|
__attribute__((constructor(0))) static void setup_qingke() {
|
||||||
@@ -10,16 +9,19 @@ __attribute__((constructor(0))) static void setup_qingke() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((constructor)) static void constructor() {
|
#define R32_RCC_APB2PCENR (*(volatile uint32_t*)0x40021018)
|
||||||
test2 = 0x5678;
|
#define R32_GPIOA_CFGLR (*(volatile uint32_t*)0x40010800)
|
||||||
}
|
#define R32_GPIOA_BSHR (*(volatile uint32_t*)0x40010810)
|
||||||
|
|
||||||
__attribute__((destructor)) static void destructor() {
|
|
||||||
test2 = 0x9abc;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
test++;
|
R32_RCC_APB2PCENR |= 1 << 2;
|
||||||
test2--;
|
R32_GPIOA_CFGLR = (R32_GPIOA_CFGLR & ~0xf) | (0b0010 << 0);
|
||||||
return 123;
|
while (1) {
|
||||||
|
R32_GPIOA_BSHR = 1 << 0;
|
||||||
|
for (int i = 0; i < 500000; i++)
|
||||||
|
asm volatile("");
|
||||||
|
R32_GPIOA_BSHR = 1 << 16;
|
||||||
|
for (int i = 0; i < 500000; i++)
|
||||||
|
asm volatile("");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user