Skip to content

Commit

Permalink
Clean up more syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
ckormanyos committed Dec 14, 2024
1 parent df5a066 commit b68d2a6
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions examples/chapter11_07/target/micros/avr/startup/int_vect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
// or copy at http://www.boost.org/LICENSE_1_0.txt)
//

#include <array>
#include <cstdint>
#include <FreeRTOS.h>
#include <mcal_cpu.h>

#include <FreeRTOS.h>
#include <array>
#include <cstddef>
#include <cstdint>

extern "C" void __my_startup () __attribute__((section(".startup"), used, noinline));
extern "C" void __vector_unused_irq() __attribute__((signal, used, externally_visible));
#if configUSE_PREEMPTION == 1
#if (defined(configUSE_PREEMPTION) && (configUSE_PREEMPTION == 1))
extern "C" void __vector_11 () __attribute__((signal, used, externally_visible, naked));
#else
extern "C" void __vector_11 () __attribute__((signal, used, externally_visible));
Expand All @@ -31,21 +32,21 @@ void __vector_unused_irq()

namespace
{
typedef struct struct_isr_type
typedef struct isr_type
{
typedef void(*function_type)();
using function_type = void(*)();

const std::uint8_t jmp[2]; // JMP instruction (0x940C): 0x0C = low byte, 0x94 = high byte.
const function_type func; // The interrupt service routine.
const std::uint8_t jmp[std::size_t { UINT8_C(2) }]; // JMP instruction (0x940C): 0x0C = low byte, 0x94 = high byte.
const function_type func; // The interrupt service routine.
}
isr_type;
}

extern "C"
const volatile std::array<isr_type, 26U> __isr_vector __attribute__((section(".isr_vector")));
const volatile std::array<isr_type, std::size_t { UINT8_C(26) }> __isr_vector __attribute__((section(".isr_vector")));

extern "C"
const volatile std::array<isr_type, 26U> __isr_vector =
const volatile std::array<isr_type, std::size_t { UINT8_C(26) }> __isr_vector =
{{
// addr. nr. interrupt source
{ { 0x0C, 0x94 }, __my_startup }, // 0x00, 0, reset
Expand Down

0 comments on commit b68d2a6

Please sign in to comment.