From c7150445af98d5cb98b970f22fbdf12d142e1f1a Mon Sep 17 00:00:00 2001 From: Phil Hord Date: Thu, 12 Dec 2013 12:05:52 -0500 Subject: [PATCH] Zungmann's fixes to compile simulator on Mac OS X, part 2. Here: .bss section syntax is different. --- analog.c | 2 +- arduino.h | 4 ++++ dda.c | 8 ++++---- dda_queue.c | 2 +- extruder/analog.c | 2 +- gcode_parse.c | 4 ++-- simulator.h | 7 +++++++ 7 files changed, 20 insertions(+), 9 deletions(-) diff --git a/analog.c b/analog.c index 59cfb5f..5330d4f 100644 --- a/analog.c +++ b/analog.c @@ -24,7 +24,7 @@ #undef DEFINE_TEMP_SENSOR static uint8_t adc_counter; -static volatile uint16_t adc_result[NUM_TEMP_SENSORS] __attribute__ ((__section__ (".bss"))); +static volatile uint16_t BSS adc_result[NUM_TEMP_SENSORS]; #define DEFINE_TEMP_SENSOR(name, type, pin, additional) \ ((type == TT_THERMISTOR) || (type == TT_AD595)) ? (pin ## _ADC) : 255, diff --git a/arduino.h b/arduino.h index fe4e357..de89ea5 100644 --- a/arduino.h +++ b/arduino.h @@ -103,4 +103,8 @@ #error pins for this chip not defined in arduino.h! If you write an appropriate pin definition and have this firmware work on your chip, please tell us via the forum thread #endif +#ifndef BSS + #define BSS __attribute__ ((__section__ (".bss"))) +#endif + #endif /* _ARDUINO_H */ diff --git a/dda.c b/dda.c index 868fe3c..5bf0163 100644 --- a/dda.c +++ b/dda.c @@ -37,20 +37,20 @@ /// \var startpoint /// \brief target position of last move in queue -TARGET startpoint __attribute__ ((__section__ (".bss"))); +TARGET BSS startpoint; /// \var startpoint_steps /// \brief target position of last move in queue, expressed in steps -TARGET startpoint_steps __attribute__ ((__section__ (".bss"))); +TARGET BSS startpoint_steps; /// \var current_position /// \brief actual position of extruder head /// \todo make current_position = real_position (from endstops) + offset from G28 and friends -TARGET current_position __attribute__ ((__section__ (".bss"))); +TARGET BSS current_position; /// \var move_state /// \brief numbers for tracking the current state of movement -MOVE_STATE move_state __attribute__ ((__section__ (".bss"))); +MOVE_STATE BSS move_state; /*! Inititalise DDA movement structures */ diff --git a/dda_queue.c b/dda_queue.c index e737132..43d64d4 100644 --- a/dda_queue.c +++ b/dda_queue.c @@ -35,7 +35,7 @@ uint8_t mb_tail = 0; /// slot will only be modified in interrupts until the slot is /// is no longer live. /// The size does not need to be a power of 2 anymore! -DDA movebuffer[MOVEBUFFER_SIZE] __attribute__ ((__section__ (".bss"))); +DDA BSS movebuffer[MOVEBUFFER_SIZE]; /// check if the queue is completely full uint8_t queue_full() { diff --git a/extruder/analog.c b/extruder/analog.c index 1ffa108..d79f9be 100644 --- a/extruder/analog.c +++ b/extruder/analog.c @@ -18,7 +18,7 @@ static const uint8_t analog_mask = 0 #undef DEFINE_TEMP_SENSOR static uint8_t adc_counter; -static volatile uint16_t adc_result[8] __attribute__ ((__section__ (".bss"))); +static volatile uint16_t BSS adc_result[8]; //! Configure all registers, start interrupt loop void analog_init() { diff --git a/gcode_parse.c b/gcode_parse.c index c86ea78..ebfc282 100644 --- a/gcode_parse.c +++ b/gcode_parse.c @@ -26,10 +26,10 @@ uint8_t last_field = 0; #define crc(a, b) (a ^ b) /// crude floating point data storage -decfloat read_digit __attribute__ ((__section__ (".bss"))); +decfloat BSS read_digit; /// this is where we store all the data for the current command before we work out what to do with it -GCODE_COMMAND next_target __attribute__ ((__section__ (".bss"))); +GCODE_COMMAND BSS next_target; /* decfloat_to_int() is the weakest subject to variable overflow. For evaluation, we assume a build room of +-1000 mm and STEPS_PER_MM_x between 1.000 and 4096. Accordingly for metric units: diff --git a/simulator.h b/simulator.h index 277d5cc..f9d7745 100644 --- a/simulator.h +++ b/simulator.h @@ -40,6 +40,13 @@ #define enable_transmit() #undef USB_SERIAL +#undef BSS +#ifdef __MACH__ // Mac OS X + #define BSS __attribute__ ((__section__ ("__DATA,.bss"))) +#else + #define BSS __attribute__ ((__section__ (".bss"))) +#endif + #ifndef _SIMULATOR_H #define _SIMULATOR_H