diff --git a/radio/src/cli.cpp b/radio/src/cli.cpp index 7897138e6..0e1971438 100644 --- a/radio/src/cli.cpp +++ b/radio/src/cli.cpp @@ -28,7 +28,7 @@ #define CLI_COMMAND_MAX_LEN 256 OS_TID cliTaskId; -TaskStack _ALIGNED(8) cliStack; // stack must be aligned to 8 bytes otherwise printf for %f does not work! +TaskStack __ALIGNED(8) cliStack; // stack must be aligned to 8 bytes otherwise printf for %f does not work! Fifo cliRxFifo; uint8_t cliTracesEnabled = true; char cliLastLine[CLI_COMMAND_MAX_LEN+1]; diff --git a/radio/src/definitions.h b/radio/src/definitions.h index 6145fd175..2c7a89b2e 100644 --- a/radio/src/definitions.h +++ b/radio/src/definitions.h @@ -21,27 +21,29 @@ #ifndef _DEFINITIONS_H_ #define _DEFINITIONS_H_ +#include + #if defined(SIMU) && __GNUC__ - #define __ALIGNED __attribute__((aligned(32))) + #define __ALIGNED(x) __attribute__((aligned(x))) #define __SECTION_USED(s) __attribute__((used)) #elif defined(SIMU) - #define __ALIGNED + #define __ALIGNED(x) __declspec(align(x)) #define __SECTION_USED(s) #else - #define __ALIGNED __attribute__((aligned(32))) - #define __SECTION_USED(s) __attribute__ ((section(s), used)) + #define __ALIGNED(x) __attribute__((aligned(x))) + #define __SECTION_USED(s) __attribute__((section(s), used)) #endif #if defined(SIMU) #define __DMA -#elif (defined(STM32F4) && !defined(BOOT)) || defined(PCBHORUS) - #define __DMA __attribute__((section(".ram"), aligned(32))) +#elif (defined(STM32F4) && !defined(BOOT)) || defined(SDRAM) + #define __DMA __attribute__((section(".ram"), aligned(4))) #else - #define __DMA __ALIGNED + #define __DMA __ALIGNED(4) #endif -#if defined(PCBHORUS) && !defined(SIMU) - #define __SDRAM __attribute__((section(".sdram"), aligned(32))) +#if defined(SDRAM) && !defined(SIMU) + #define __SDRAM __attribute__((section(".sdram"), aligned(4))) #define __NOINIT __attribute__((section(".noinit"))) #else #define __SDRAM __DMA diff --git a/radio/src/gui/480x272/bitmaps.cpp b/radio/src/gui/480x272/bitmaps.cpp index 4fcf8cce4..288e8c40d 100644 --- a/radio/src/gui/480x272/bitmaps.cpp +++ b/radio/src/gui/480x272/bitmaps.cpp @@ -140,23 +140,23 @@ const uint8_t LBM_SHUTDOWN_CIRCLE[] = { #include "mask_shutdown_circle.lbm" }; -const uint8_t LBM_SLIDER_BAR_LEFT[] __ALIGNED = { +const uint8_t LBM_SLIDER_BAR_LEFT[] __ALIGNED(4) = { #include "bar_left.lbm" }; -const uint8_t LBM_SLIDER_BAR_RIGHT[] __ALIGNED = { +const uint8_t LBM_SLIDER_BAR_RIGHT[] __ALIGNED(4) = { #include "bar_right.lbm" }; -const uint8_t LBM_SLIDER_POINT_OUT[] __ALIGNED = { +const uint8_t LBM_SLIDER_POINT_OUT[] __ALIGNED(4) = { #include "point_out.lbm" }; -const uint8_t LBM_SLIDER_POINT_MID[] __ALIGNED = { +const uint8_t LBM_SLIDER_POINT_MID[] __ALIGNED(4) = { #include "point_mid.lbm" }; -const uint8_t LBM_SLIDER_POINT_IN[] __ALIGNED = { +const uint8_t LBM_SLIDER_POINT_IN[] __ALIGNED(4) = { #include "point_in.lbm" }; diff --git a/radio/src/pulses/pulses_arm.h b/radio/src/pulses/pulses_arm.h index ab5cfa2ef..060700448 100644 --- a/radio/src/pulses/pulses_arm.h +++ b/radio/src/pulses/pulses_arm.h @@ -148,7 +148,7 @@ union ModulePulsesData { PpmPulsesData ppm; CrossfirePulsesData crossfire; -} __ALIGNED; +} __ALIGNED(4); /* The __ALIGNED keyword is required to align the struct inside the modulePulsesData below, * which is also defined to be __DMA (which includes __ALIGNED) aligned. diff --git a/radio/src/tasks_arm.cpp b/radio/src/tasks_arm.cpp index aa41af586..641942e1f 100644 --- a/radio/src/tasks_arm.cpp +++ b/radio/src/tasks_arm.cpp @@ -22,7 +22,7 @@ OS_TID menusTaskId; // menus stack must be aligned to 8 bytes otherwise printf for %f does not work! -TaskStack _ALIGNED(8) menusStack; +TaskStack __ALIGNED(8) menusStack; OS_TID mixerTaskId; TaskStack mixerStack; diff --git a/radio/src/tasks_arm.h b/radio/src/tasks_arm.h index abd0e66d7..164ba4bae 100644 --- a/radio/src/tasks_arm.h +++ b/radio/src/tasks_arm.h @@ -32,12 +32,6 @@ extern "C" { #define AUDIO_STACK_SIZE 500 #define BLUETOOTH_STACK_SIZE 500 -#if defined(_MSC_VER) -#define _ALIGNED(x) __declspec(align(x)) -#elif defined(__GNUC__) -#define _ALIGNED(x) __attribute__ ((aligned(x))) -#endif - uint16_t getStackAvailable(void * address, uint16_t size); template diff --git a/radio/util/img2lbm.py b/radio/util/img2lbm.py index 40d2dc69c..0837738c7 100755 --- a/radio/util/img2lbm.py +++ b/radio/util/img2lbm.py @@ -164,7 +164,6 @@ with open(output_filename, "w") as f: elif what == "4/4/4/4": constant = sys.argv[2].upper()[:-4] values = [] - #f.write("const uint8_t __%s[] __ALIGNED = {\n" % constant) writeSize(f, width, height) for y in range(height): for x in range(width): @@ -179,7 +178,6 @@ with open(output_filename, "w") as f: elif what == "5/6/5": constant = sys.argv[2].upper()[:-4] values = [] - #f.write("const uint8_t __%s[] __ALIGNED = {\n" % constant) writeSize(f, width, height) for y in range(height): for x in range(width):