mirror of
https://github.com/opentx/opentx.git
synced 2025-07-20 06:45:10 +03:00
__ALIGNED macro unified
This commit is contained in:
parent
d47c3cedb4
commit
f60733b561
7 changed files with 19 additions and 25 deletions
|
@ -28,7 +28,7 @@
|
||||||
#define CLI_COMMAND_MAX_LEN 256
|
#define CLI_COMMAND_MAX_LEN 256
|
||||||
|
|
||||||
OS_TID cliTaskId;
|
OS_TID cliTaskId;
|
||||||
TaskStack<CLI_STACK_SIZE> _ALIGNED(8) cliStack; // stack must be aligned to 8 bytes otherwise printf for %f does not work!
|
TaskStack<CLI_STACK_SIZE> __ALIGNED(8) cliStack; // stack must be aligned to 8 bytes otherwise printf for %f does not work!
|
||||||
Fifo<uint8_t, 256> cliRxFifo;
|
Fifo<uint8_t, 256> cliRxFifo;
|
||||||
uint8_t cliTracesEnabled = true;
|
uint8_t cliTracesEnabled = true;
|
||||||
char cliLastLine[CLI_COMMAND_MAX_LEN+1];
|
char cliLastLine[CLI_COMMAND_MAX_LEN+1];
|
||||||
|
|
|
@ -21,27 +21,29 @@
|
||||||
#ifndef _DEFINITIONS_H_
|
#ifndef _DEFINITIONS_H_
|
||||||
#define _DEFINITIONS_H_
|
#define _DEFINITIONS_H_
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
|
||||||
#if defined(SIMU) && __GNUC__
|
#if defined(SIMU) && __GNUC__
|
||||||
#define __ALIGNED __attribute__((aligned(32)))
|
#define __ALIGNED(x) __attribute__((aligned(x)))
|
||||||
#define __SECTION_USED(s) __attribute__((used))
|
#define __SECTION_USED(s) __attribute__((used))
|
||||||
#elif defined(SIMU)
|
#elif defined(SIMU)
|
||||||
#define __ALIGNED
|
#define __ALIGNED(x) __declspec(align(x))
|
||||||
#define __SECTION_USED(s)
|
#define __SECTION_USED(s)
|
||||||
#else
|
#else
|
||||||
#define __ALIGNED __attribute__((aligned(32)))
|
#define __ALIGNED(x) __attribute__((aligned(x)))
|
||||||
#define __SECTION_USED(s) __attribute__ ((section(s), used))
|
#define __SECTION_USED(s) __attribute__((section(s), used))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SIMU)
|
#if defined(SIMU)
|
||||||
#define __DMA
|
#define __DMA
|
||||||
#elif (defined(STM32F4) && !defined(BOOT)) || defined(PCBHORUS)
|
#elif (defined(STM32F4) && !defined(BOOT)) || defined(SDRAM)
|
||||||
#define __DMA __attribute__((section(".ram"), aligned(32)))
|
#define __DMA __attribute__((section(".ram"), aligned(4)))
|
||||||
#else
|
#else
|
||||||
#define __DMA __ALIGNED
|
#define __DMA __ALIGNED(4)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PCBHORUS) && !defined(SIMU)
|
#if defined(SDRAM) && !defined(SIMU)
|
||||||
#define __SDRAM __attribute__((section(".sdram"), aligned(32)))
|
#define __SDRAM __attribute__((section(".sdram"), aligned(4)))
|
||||||
#define __NOINIT __attribute__((section(".noinit")))
|
#define __NOINIT __attribute__((section(".noinit")))
|
||||||
#else
|
#else
|
||||||
#define __SDRAM __DMA
|
#define __SDRAM __DMA
|
||||||
|
|
|
@ -140,23 +140,23 @@ const uint8_t LBM_SHUTDOWN_CIRCLE[] = {
|
||||||
#include "mask_shutdown_circle.lbm"
|
#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"
|
#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"
|
#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"
|
#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"
|
#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"
|
#include "point_in.lbm"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -148,7 +148,7 @@ union ModulePulsesData {
|
||||||
|
|
||||||
PpmPulsesData<pulse_duration_t> ppm;
|
PpmPulsesData<pulse_duration_t> ppm;
|
||||||
CrossfirePulsesData crossfire;
|
CrossfirePulsesData crossfire;
|
||||||
} __ALIGNED;
|
} __ALIGNED(4);
|
||||||
|
|
||||||
/* The __ALIGNED keyword is required to align the struct inside the modulePulsesData below,
|
/* The __ALIGNED keyword is required to align the struct inside the modulePulsesData below,
|
||||||
* which is also defined to be __DMA (which includes __ALIGNED) aligned.
|
* which is also defined to be __DMA (which includes __ALIGNED) aligned.
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
OS_TID menusTaskId;
|
OS_TID menusTaskId;
|
||||||
// menus stack must be aligned to 8 bytes otherwise printf for %f does not work!
|
// menus stack must be aligned to 8 bytes otherwise printf for %f does not work!
|
||||||
TaskStack<MENUS_STACK_SIZE> _ALIGNED(8) menusStack;
|
TaskStack<MENUS_STACK_SIZE> __ALIGNED(8) menusStack;
|
||||||
|
|
||||||
OS_TID mixerTaskId;
|
OS_TID mixerTaskId;
|
||||||
TaskStack<MIXER_STACK_SIZE> mixerStack;
|
TaskStack<MIXER_STACK_SIZE> mixerStack;
|
||||||
|
|
|
@ -32,12 +32,6 @@ extern "C" {
|
||||||
#define AUDIO_STACK_SIZE 500
|
#define AUDIO_STACK_SIZE 500
|
||||||
#define BLUETOOTH_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);
|
uint16_t getStackAvailable(void * address, uint16_t size);
|
||||||
|
|
||||||
template<int SIZE>
|
template<int SIZE>
|
||||||
|
|
|
@ -164,7 +164,6 @@ with open(output_filename, "w") as f:
|
||||||
elif what == "4/4/4/4":
|
elif what == "4/4/4/4":
|
||||||
constant = sys.argv[2].upper()[:-4]
|
constant = sys.argv[2].upper()[:-4]
|
||||||
values = []
|
values = []
|
||||||
#f.write("const uint8_t __%s[] __ALIGNED = {\n" % constant)
|
|
||||||
writeSize(f, width, height)
|
writeSize(f, width, height)
|
||||||
for y in range(height):
|
for y in range(height):
|
||||||
for x in range(width):
|
for x in range(width):
|
||||||
|
@ -179,7 +178,6 @@ with open(output_filename, "w") as f:
|
||||||
elif what == "5/6/5":
|
elif what == "5/6/5":
|
||||||
constant = sys.argv[2].upper()[:-4]
|
constant = sys.argv[2].upper()[:-4]
|
||||||
values = []
|
values = []
|
||||||
#f.write("const uint8_t __%s[] __ALIGNED = {\n" % constant)
|
|
||||||
writeSize(f, width, height)
|
writeSize(f, width, height)
|
||||||
for y in range(height):
|
for y in range(height):
|
||||||
for x in range(width):
|
for x in range(width):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue