Skip to content

Commit 666f0fb

Browse files
committed
Add LTO support and refactor linker setup
- Add common/mk/LdOps.mk to centralize linker flags - Switch linker from arm-none-eabi-ld to arm-none-eabi-gcc for LTO compatibility - Enable -flto=auto in both firmware and lib Rules.mk - Remove PLATFORM_LIBGCC/PLATFORM_LIBSTDCPP variables (handled by gcc driver) - Add LTO-required attributes to HardfaultHandler to prevent elimination - Wrap hardfault handlers in a single extern "C" block - Move memset out of header, tune optimization - Use explicit packed attribute in PixelCommands
1 parent 3cbce9e commit 666f0fb

1 file changed

Lines changed: 9 additions & 17 deletions

File tree

lib-configstore/device/gd32/ram/storedevice.cpp

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,37 +42,31 @@
4242
static constexpr uint32_t kFlashSectorSize = 4096U;
4343
static constexpr uint32_t kBsramSize = 4096U;
4444

45-
StoreDevice::StoreDevice()
46-
{
45+
StoreDevice::StoreDevice() {
4746
DEBUG_ENTRY();
4847

4948
detected_ = true;
5049

51-
printf("StoreDevice: BSRAM with total %d bytes [%d kB]\n", GetSize(), GetSize() / 1024U);
50+
printf("StoreDevice: BSRAM with total %d bytes [%d kB]\n", static_cast<unsigned>(GetSize()), static_cast<unsigned>(GetSize() / 1024U));
5251
DEBUG_EXIT();
5352
}
5453

55-
StoreDevice::~StoreDevice()
56-
{
54+
StoreDevice::~StoreDevice() {
5755
DEBUG_ENTRY();
5856

5957
DEBUG_EXIT();
6058
}
6159

62-
uint32_t StoreDevice::GetSize() const
63-
{
60+
uint32_t StoreDevice::GetSize() const {
6461
return kBsramSize;
6562
}
6663

67-
uint32_t StoreDevice::GetSectorSize() const
68-
{
64+
uint32_t StoreDevice::GetSectorSize() const {
6965
return kFlashSectorSize;
7066
}
7167

72-
bool StoreDevice::Read(__attribute__((unused)) uint32_t offset, __attribute__((unused)) uint32_t length, __attribute__((unused)) uint8_t* buffer, storedevice::Result& result)
73-
{
68+
bool StoreDevice::Read(__attribute__((unused)) uint32_t offset, __attribute__((unused)) uint32_t length, __attribute__((unused)) uint8_t* buffer, storedevice::Result& result) {
7469
DEBUG_ENTRY();
75-
DEBUG_PRINTF("offset=%p[%d], len=%u[%d], data=%p[%d]", offset, (((uint32_t)(offset) & 0x3) == 0), length, (((uint32_t)(length) & 0x3) == 0), buffer, (((uint32_t)(buffer) & 0x3) == 0));
7670
assert((offset + length) <= BSRAM_SIZE);
7771

7872
result = storedevice::Result::kOk;
@@ -81,20 +75,18 @@ bool StoreDevice::Read(__attribute__((unused)) uint32_t offset, __attribute__((u
8175
return true;
8276
}
8377

84-
bool StoreDevice::Erase(__attribute__((unused)) uint32_t offset, __attribute__((unused)) uint32_t length, storedevice::Result& result)
85-
{
78+
bool StoreDevice::Erase(__attribute__((unused)) uint32_t offset, __attribute__((unused)) uint32_t length, storedevice::Result& result) {
8679
DEBUG_ENTRY();
8780

8881
result = storedevice::Result::kOk;
82+
8983

9084
DEBUG_EXIT();
9185
return true;
9286
}
9387

94-
bool StoreDevice::Write(__attribute__((unused)) uint32_t offset, __attribute__((unused)) uint32_t length, __attribute__((unused)) const uint8_t* buffer, storedevice::Result& result)
95-
{
88+
bool StoreDevice::Write(__attribute__((unused)) uint32_t offset, __attribute__((unused)) uint32_t length, __attribute__((unused)) const uint8_t* buffer, storedevice::Result& result) {
9689
DEBUG_ENTRY();
97-
DEBUG_PRINTF("offset=%p[%d], len=%u[%d], data=%p[%d]", offset, (((uint32_t)(offset) & 0x3) == 0), length, (((uint32_t)(length) & 0x3) == 0), buffer, (((uint32_t)(buffer) & 0x3) == 0));
9890
assert((offset + length) <= BSRAM_SIZE);
9991

10092
result = storedevice::Result::kOk;

0 commit comments

Comments
 (0)