fix variable scope, multiple declerations error with gcc 10

This commit is contained in:
crinq
2021-12-15 15:32:30 +01:00
committed by crinq
parent 2ce86fa40b
commit bd463547d0
10 changed files with 40 additions and 33 deletions

View File

@@ -18,7 +18,4 @@
void setup(void);
void setup_res(void);
volatile uint32_t ADC_DMA_Buffer0[ADC_SAMPLES_IN_RT]; //240
volatile uint32_t ADC_DMA_Buffer1[ADC_SAMPLES_IN_RT];
RCC_ClocksTypeDef RCC_Clocks;

View File

@@ -13,6 +13,9 @@
#define TERM_NUM_WAVES 8
extern volatile uint32_t ADC_DMA_Buffer0[ADC_SAMPLES_IN_RT]; //240
extern volatile uint32_t ADC_DMA_Buffer1[ADC_SAMPLES_IN_RT];
HAL_COMP(adc);
HAL_PIN(sin0); //sin output

View File

@@ -37,8 +37,8 @@ struct enc_fb_ctx_t {
float absoffset;
};
int indexpos = 0;
int indexprint = 0;
static int indexpos = 0;
static int indexprint = 0;
static void nrt_init(void *ctx_ptr, hal_pin_inst_t *pin_ptr) {
struct enc_fb_ctx_t *ctx = (struct enc_fb_ctx_t *)ctx_ptr;

View File

@@ -28,9 +28,9 @@ HAL_PIN(crc_er);
HAL_PIN(freq);
HAL_PIN(bit_ticks);
volatile uint32_t sendf;
uint32_t send_counterf;
volatile uint16_t tim_data[160];
static volatile uint32_t sendf;
static uint32_t send_counterf;
static volatile uint16_t tim_data[160];
#pragma pack(push, 1)
typedef struct {
@@ -90,14 +90,14 @@ data regardless of the index status. Note that the commutation track
seems to be interpolated so is not better than maybe 1% accuracy
*/
union {
static union {
uint8_t enc_data[10];
fanuc_t fanuc;
} data;
uint8_t print_buf[10];
static uint8_t print_buf[10];
int32_t pos_offset;
uint32_t state_counter;
static int32_t pos_offset;
static uint32_t state_counter;
static void nrt_init(void *ctx_ptr, hal_pin_inst_t *pin_ptr) {
// struct encf_ctx_t *ctx = (struct encf_ctx_t *)ctx_ptr;

View File

@@ -35,8 +35,8 @@ HAL_PIN(pos);
HAL_PIN(error);
HAL_PIN(state);
volatile uint32_t request_buf[24];
volatile uint16_t tim_data[300];
static volatile uint32_t request_buf[24];
static volatile uint16_t tim_data[300];
#pragma pack(push, 1)
typedef union {

View File

@@ -2,6 +2,7 @@
#include "commands.h"
#include "hal.h"
#include "math.h"
#include "crc.h"
#include "defines.h"
#include "angle.h"
#include "stm32f4xx_conf.h"

View File

@@ -70,16 +70,16 @@ struct sserial_ctx_t {
uint32_t phase;
};
volatile uint8_t rxbuf[128]; //rx dma buffer
volatile uint8_t txbuf[128]; //tx dma buffer
uint16_t address; //current address pointer
int rxpos; //read pointer for rx ringbuffer
uint32_t timeout;
lbp_t lbp;
const char name[] = LBPCardName;
unit_no_t unit;
uint32_t max_waste_ticks;
uint32_t block_bytes;
static volatile uint8_t rxbuf[128]; //rx dma buffer
static volatile uint8_t txbuf[128]; //tx dma buffer
static uint16_t address; //current address pointer
static int rxpos; //read pointer for rx ringbuffer
static uint32_t timeout;
static lbp_t lbp;
static const char name[] = LBPCardName;
static unit_no_t unit;
static uint32_t max_waste_ticks;
static uint32_t block_bytes;
#pragma pack(push, 1)
//*****************************************************************************

View File

@@ -34,15 +34,15 @@ HAL_PIN(crc_ok);
HAL_PIN(crc_error);
//TODO: use context
volatile uint32_t txbuf[128];
int pos;
int dfdf;
volatile char m_data[150];
volatile char m_data2[150];
volatile uint16_t tim_data[300];
DMA_InitTypeDef DMA_InitStructuretx;
DMA_InitTypeDef DMA_InitStructurerx;
uint8_t yaskawa_reply[14];
static volatile uint32_t txbuf[128];
static int pos;
static int dfdf;
static volatile char m_data[150];
static volatile char m_data2[150];
static volatile uint16_t tim_data[300];
static DMA_InitTypeDef DMA_InitStructuretx;
static DMA_InitTypeDef DMA_InitStructurerx;
static uint8_t yaskawa_reply[14];
//uint8_t yaskara_reply_len;
static void nrt_init(void *ctx_ptr, hal_pin_inst_t *pin_ptr) {

View File

@@ -28,6 +28,8 @@
#include "main.h"
#include "commands.h"
extern RCC_ClocksTypeDef RCC_Clocks;
uint32_t hal_get_systick_value() {
return (SysTick->VAL);
}

View File

@@ -10,6 +10,10 @@
#include "usbd_cdc_if.h"
#include "defines.h"
RCC_ClocksTypeDef RCC_Clocks;
volatile uint32_t ADC_DMA_Buffer0[ADC_SAMPLES_IN_RT]; //240
volatile uint32_t ADC_DMA_Buffer1[ADC_SAMPLES_IN_RT];
void setup() {
//Enable clocks
//TODO: small f4 does not have GPIOE