Skip to content

Commit

Permalink
Fix for ITCM overflow for F722 (#13521)
Browse files Browse the repository at this point in the history
* Fix for ITCM overflow for F722

* Better comments in target.h
  • Loading branch information
blckmn committed Apr 11, 2024
1 parent 7073b0e commit 7c8a552
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/main/common/sdft.c
Expand Up @@ -71,7 +71,7 @@ void sdftInit(sdft_t *sdft, const int startBin, const int endBin, const int numB
FAST_CODE void sdftPush(sdft_t *sdft, const float sample)
{
const float delta = sample - rPowerN * sdft->samples[sdft->idx];

sdft->samples[sdft->idx] = sample;
sdft->idx = (sdft->idx + 1) % SDFT_SAMPLE_SIZE;

Expand Down
6 changes: 3 additions & 3 deletions src/main/drivers/rx/rx_sx1280.c
Expand Up @@ -76,7 +76,7 @@ bool sx1280IsBusy(void)
return IORead(busy);
}

FAST_CODE static bool sx1280PollBusy(void)
FAST_CODE_PREF static bool sx1280PollBusy(void)
{
uint32_t startTime = micros();
while (IORead(busy)) {
Expand All @@ -89,7 +89,7 @@ FAST_CODE static bool sx1280PollBusy(void)
return true;
}

FAST_CODE static bool sx1280MarkBusy(void)
FAST_CODE_PREF static bool sx1280MarkBusy(void)
{
// Check that there isn't already a sequence of accesses to the SX1280 in progress
ATOMIC_BLOCK(NVIC_PRIO_MAX) {
Expand All @@ -109,7 +109,7 @@ static void sx1280ClearBusyFn(void)
}

// Switch to waiting for busy interrupt
FAST_CODE static bool sx1280EnableBusy(void)
FAST_CODE_PREF static bool sx1280EnableBusy(void)
{
if (!sx1280MarkBusy()) {
return false;
Expand Down
3 changes: 3 additions & 0 deletions src/main/target/STM32F745/target.h
Expand Up @@ -85,3 +85,6 @@
#define USE_EXTI

#define FLASH_PAGE_SIZE ((uint32_t)0x8000) // 32K sectors

// ITCM is in short supply so excluding fast code where preferred, not required.
#define FAST_CODE_PREF
3 changes: 3 additions & 0 deletions src/main/target/STM32F7X2/target.h
Expand Up @@ -77,3 +77,6 @@
#define USE_EXTI

#define FLASH_PAGE_SIZE ((uint32_t)0x4000) // 16K sectors

// ITCM is in short supply so excluding fast code where preferred, not required.
#define FAST_CODE_PREF
10 changes: 5 additions & 5 deletions src/main/target/common_post.h
Expand Up @@ -51,13 +51,13 @@
#else
#define FAST_CODE __attribute__((section(".tcm_code")))
#endif
// Handle case where we'd prefer code to be in ITCM, but it won't fit on the F745
#ifdef STM32F745xx
#define FAST_CODE_PREF
#else
#define FAST_CODE_PREF __attribute__((section(".tcm_code")))
// Handle case where we'd prefer code to be in ITCM, but it won't fit on the device
#ifndef FAST_CODE_PREF
#define FAST_CODE_PREF FAST_CODE
#endif

#define FAST_CODE_NOINLINE NOINLINE

#else
#define FAST_CODE
#define FAST_CODE_PREF
Expand Down

0 comments on commit 7c8a552

Please sign in to comment.