Skip to content

Commit 2f3bf0b

Browse files
committed
Perform more syntax improvements
1 parent 3213d07 commit 2f3bf0b

File tree

4 files changed

+30
-26
lines changed

4 files changed

+30
-26
lines changed

ref_app/src/mcal/am6254_soc/mcal_cpu.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@
3939

4040
inline auto nop() noexcept -> void { asm volatile("nop"); }
4141

42-
inline auto acquire_spin_lock(volatile std::uint32_t* p_sync) noexcept -> void { mcal_cpu_secure_acquire_spin_lock(p_sync); }
43-
inline auto release_spin_lock(volatile std::uint32_t* p_sync) noexcept -> void { mcal_cpu_secure_release_spin_lock(p_sync); }
42+
struct secure
43+
{
44+
static auto acquire_spin_lock(volatile std::uint32_t* p_sync) noexcept -> void { mcal_cpu_secure_acquire_spin_lock(p_sync); }
45+
static auto release_spin_lock(volatile std::uint32_t* p_sync) noexcept -> void { mcal_cpu_secure_release_spin_lock(p_sync); }
46+
};
4447
}
4548
}
4649
#endif

ref_app/src/mcal/am6254_soc/mcal_port.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,17 @@
99

1010
void mcal::port::init(const config_type*)
1111
{
12-
// The pad configuration of gpio0.37 is on pad37 (empirical observation).
13-
// So we must initialize pad37 since we will use gpio0.36 as the
14-
// benchmark toggle-pin.
12+
// Initialize the benchmark toggle pin explicitly, even though
13+
// this is also done in the application benchmark when one
14+
// of the benchmarks is active.
15+
1516
mcal::port::port_pin<mcal::reg::gpio0, 36U>::set_pin_low();
1617
mcal::port::port_pin<mcal::reg::gpio0, 36U>::set_direction_output();
1718

19+
// Empirical observation seemingly reveals that the pad configuration
20+
// of gpio0.36 is mistakenly on pad37. So we must initialize pad37
21+
// as well since we will use gpio0.36 as the benchmark toggle-pin.
22+
1823
mcal::port::port_pin<mcal::reg::gpio0, 37U>::set_pin_low();
1924
mcal::port::port_pin<mcal::reg::gpio0, 37U>::set_direction_output();
2025
}

ref_app/src/mcal/am6254_soc/mcal_port.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// or copy at http://www.boost.org/LICENSE_1_0.txt)
66
//
77

8-
#ifndef MCAL_PORT_2014_01_10_H_
9-
#define MCAL_PORT_2014_01_10_H_
8+
#ifndef MCAL_PORT_2014_01_10_H
9+
#define MCAL_PORT_2014_01_10_H
1010

1111
#include <mcal_cpu.h>
1212
#include <mcal_reg.h>
@@ -33,9 +33,9 @@
3333
public:
3434
static auto set_direction_output() noexcept -> void
3535
{
36-
mcal::cpu::acquire_spin_lock(&sync_object);
36+
mcal::cpu::secure::acquire_spin_lock(&sync_object);
3737
GPIO_CONFIG_AS_OUTPUT();
38-
mcal::cpu::release_spin_lock(&sync_object);
38+
mcal::cpu::secure::release_spin_lock(&sync_object);
3939
}
4040

4141
static auto set_direction_input() noexcept -> void
@@ -45,18 +45,18 @@
4545

4646
static auto set_pin_high() noexcept -> void
4747
{
48-
mcal::cpu::acquire_spin_lock(&sync_object);
48+
mcal::cpu::secure::acquire_spin_lock(&sync_object);
4949
OUTPUT_HIGH();
5050
output_is_high = true;
51-
mcal::cpu::release_spin_lock(&sync_object);
51+
mcal::cpu::secure::release_spin_lock(&sync_object);
5252
}
5353

5454
static auto set_pin_low() noexcept -> void
5555
{
56-
mcal::cpu::acquire_spin_lock(&sync_object);
56+
mcal::cpu::secure::acquire_spin_lock(&sync_object);
5757
OUTPUT_LOW();
5858
output_is_high = false;
59-
mcal::cpu::release_spin_lock(&sync_object);
59+
mcal::cpu::secure::release_spin_lock(&sync_object);
6060
}
6161

6262
static auto read_input_value() noexcept -> bool
@@ -67,10 +67,10 @@
6767

6868
static auto toggle_pin() noexcept -> void
6969
{
70-
mcal::cpu::acquire_spin_lock(&sync_object);
70+
mcal::cpu::secure::acquire_spin_lock(&sync_object);
7171
(output_is_high ? OUTPUT_LOW() : OUTPUT_HIGH());
7272
output_is_high = (!output_is_high);
73-
mcal::cpu::release_spin_lock(&sync_object);
73+
mcal::cpu::secure::release_spin_lock(&sync_object);
7474
}
7575

7676
private:

ref_app/target/micros/am6254_soc/make/am6254_soc_flags.gmk

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ TGT_SUFFIX = elf
1818

1919
TGT_ALLFLAGS = -O2 \
2020
-finline-functions \
21-
-finline-limit=32 \
21+
-finline-limit=128 \
2222
-mcpu=cortex-a53 \
2323
-march=armv8-a \
2424
-mabi=lp64
@@ -31,15 +31,8 @@ TGT_CFLAGS = -std=c11
3131
TGT_CXXFLAGS = -std=c++20 \
3232
$(TGT_ALLFLAGS)
3333

34-
TGT_INCLUDES = -I$(PATH_TGT)/Code \
35-
-I$(PATH_TGT)/Code/Appli/ \
36-
-I$(PATH_TGT)/Code/Appli/Core/$(CORE_FAMILY) \
37-
-I$(PATH_TGT)/Code/Mcal \
38-
-I$(PATH_TGT)/Code/Mcal/SysTickTimer \
39-
-I$(PATH_TGT)/Code/Startup \
40-
-I$(PATH_TGT)/Code/Startup/Core/$(CORE_FAMILY) \
41-
-I$(PATH_APP)/mcal/$(TGT) \
42-
-I$(PATH_APP)
34+
TGT_INCLUDES = -I$(PATH_TGT)/Code/Appli/Core/$(CORE_FAMILY) \
35+
-I$(PATH_TGT)/Code/Startup/Core/$(CORE_FAMILY)
4336

4437
TGT_AFLAGS =
4538

@@ -57,4 +50,7 @@ ifeq ($(TYP_OS),WIN)
5750
OBJCOPY := $(subst /,\,$(PATH_TOOLS_CC)/$(GCC_PREFIX)-objcopy.exe)
5851
endif
5952

60-
RULE_SPECIAL_MAKE_IMAGE_FILE := $(ECHO) "+++ creating special image file $(PATH_BIN)/$(CORE_FAMILY)_baremetal_am6254_nosdk.bin" && $(OBJCOPY) $(APP).$(TGT_SUFFIX) -O binary $(PATH_BIN)/$(CORE_FAMILY)_baremetal_am6254_nosdk.bin
53+
NAME_IMAGE_FILE := $(PATH_BIN)/$(CORE_FAMILY)_baremetal_am6254_nosdk
54+
55+
RULE_SPECIAL_MAKE_IMAGE_FILE := $(ECHO) "+++ creating special image file $(NAME_IMAGE_FILE).bin" \
56+
&& $(OBJCOPY) $(APP).$(TGT_SUFFIX) -O binary $(NAME_IMAGE_FILE).bin

0 commit comments

Comments
 (0)