arm: clang-format
This commit is contained in:
parent
932b8d4582
commit
574e48474b
9
arm/.clang-format
Normal file
9
arm/.clang-format
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
# We'll use defaults from the LLVM style, but with 4 columns indentation.
|
||||
BasedOnStyle: Google
|
||||
IndentWidth: 4
|
||||
---
|
||||
Language: Cpp
|
||||
# Force pointers to the type for C++.
|
||||
DerivePointerAlignment: false
|
||||
PointerAlignment: Left
|
@ -3,14 +3,9 @@
|
||||
extern "C" int main();
|
||||
extern uint32_t _bss_begin, _bss_end, _initial_stack_pointer;
|
||||
|
||||
__attribute__((section(".app_init")))
|
||||
void AppInit() {
|
||||
__attribute__((section(".app_init"), used)) void AppInit() {
|
||||
*(uint32_t*)(0x40000000) = 0;
|
||||
asm ("mov sp, %0"
|
||||
:
|
||||
: "r" (&_initial_stack_pointer)
|
||||
:
|
||||
);
|
||||
asm("mov sp, %0" : : "r"(&_initial_stack_pointer) :);
|
||||
|
||||
// clear .bss
|
||||
for (uint32_t* ptr = &_bss_begin; ptr < &_bss_end; ptr++) {
|
||||
@ -19,5 +14,6 @@ void AppInit() {
|
||||
|
||||
main();
|
||||
|
||||
while(true) {}
|
||||
while (true) {
|
||||
}
|
||||
}
|
||||
|
@ -7,13 +7,12 @@ namespace {
|
||||
|
||||
uint8_t UartRead() {
|
||||
uint8_t c;
|
||||
while (XUartLite_Recv(uart0, &c, 1) < 1) {}
|
||||
while (XUartLite_Recv(uart0, &c, 1) < 1) {
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
void UartWrite(uint8_t c) {
|
||||
XUartLite_Send(uart0, &c, 1);
|
||||
}
|
||||
void UartWrite(uint8_t c) { XUartLite_Send(uart0, &c, 1); }
|
||||
|
||||
uint32_t UartRead32() {
|
||||
uint32_t val = 0;
|
||||
@ -34,7 +33,7 @@ int main() {
|
||||
|
||||
InitUarts();
|
||||
|
||||
while(1) {
|
||||
while (1) {
|
||||
uint8_t c = UartRead();
|
||||
if (c == 'c') {
|
||||
uint32_t addr = UartRead32();
|
||||
@ -56,7 +55,7 @@ int main() {
|
||||
|
||||
addr |= 0x0001;
|
||||
|
||||
auto jump = reinterpret_cast<void(*)()>(addr);
|
||||
auto jump = reinterpret_cast<void (*)()>(addr);
|
||||
jump();
|
||||
}
|
||||
}
|
||||
|
@ -18,13 +18,13 @@ void ResetHandler() {
|
||||
|
||||
main();
|
||||
|
||||
while(true) {}
|
||||
while (true) {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
__attribute__((section(".vector_table"), used))
|
||||
uint32_t vector_table[16] = {
|
||||
__attribute__((section(".vector_table"), used)) uint32_t vector_table[16] = {
|
||||
[StackPointer] = reinterpret_cast<uint32_t>(&_initial_stack_pointer),
|
||||
[Reset] = reinterpret_cast<uint32_t>(ResetHandler),
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user