diff --git a/arm/.clang-format b/arm/.clang-format new file mode 100644 index 0000000..0fa7c90 --- /dev/null +++ b/arm/.clang-format @@ -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 diff --git a/arm/app_init.cc b/arm/app_init.cc index 9afc20b..d7f6d33 100644 --- a/arm/app_init.cc +++ b/arm/app_init.cc @@ -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) { + } } diff --git a/arm/bootloader.cc b/arm/bootloader.cc index 10348a2..5d81f72 100644 --- a/arm/bootloader.cc +++ b/arm/bootloader.cc @@ -7,20 +7,19 @@ 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; // little endian - val |= (UartRead() << 0); - val |= (UartRead() << 8); + val |= (UartRead() << 0); + val |= (UartRead() << 8); val |= (UartRead() << 16); val |= (UartRead() << 24); @@ -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(addr); + auto jump = reinterpret_cast(addr); jump(); } } diff --git a/arm/vector_table.cc b/arm/vector_table.cc index faade0e..3a19732 100644 --- a/arm/vector_table.cc +++ b/arm/vector_table.cc @@ -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(&_initial_stack_pointer), [Reset] = reinterpret_cast(ResetHandler), };