Notifications
Clear all

Error Compiling 3.3.1  

  RSS
chris.h37
(@chris-h37)
New Member
Error Compiling 3.3.1

I am getting this fault while using Arduino 1.6.8. I was able to work around it by disabling M45 by commenting out the content of *bool gcode_M45(bool onlyZ, int8_t verbosity_level)*. I have copied the error messages below. The section of code that was causing the fault is also below, the error is highlighting the last closing bracket. I tried compiling 3.1.0 that had worked before with the same error, so I suspect that the problem lies in my Arduino libraries, but I'm not sure what might be missing or wrong. I also tried uninstalling/reinstalling Arduino without success. This is pretty much the same fault as https://shop.prusa3d.com/forum/hardware-firmware-and-software-help-f44/error-compiling-3-1-4-final-solved--t15548.html#p87152 but the solution of using Arduino 1.6.8 obviously isn't working.

Current version of Arduino: 1.6.8
Board: RAMBo
Programmer AVRISP mkII
libraries up to date

**************************************************************************************************************************
***********************************************************************************************************************
***********************************************************************************************************************
Error codes:[/b]
***********************************************************************************************************************
***********************************************************************************************************************
***********************************************************************************************************************

C:\Users\CHRISV~1\AppData\Local\Temp\build286d99eee49288fbf0cf93d658208031.tmp\sketch\Marlin_main.cpp: In function 'gcode_M45.constprop':

Marlin_main.cpp:3106: error: unrecognizable insn:

}

^

(insn 820 819 821 28 (set (reg:QI 962)

(subreg:QI (mem/v/c:SI (plus:HI (reg/f:HI 961)

(const_int 8 [0x8])) [6 count_position+8 S4 A8]) 3)) C:\Users\CHRISV~1\AppData\Local\Temp\build286d99eee49288fbf0cf93d658208031.tmp\sketch\xyzcal.cpp:773 -1

(nil))

C:\Users\CHRISV~1\AppData\Local\Temp\build286d99eee49288fbf0cf93d658208031.tmp\sketch\Marlin_main.cpp:3106:1: internal compiler error: in extract_insn, at recog.c:2202

libbacktrace could not find executable to open

Please submit a full bug report,

with preprocessed source if appropriate.

See < http://gcc.gnu.org/bugs.html > for instructions.

lto-wrapper: C:\Users\Chris Vahi\AppData\Local\Arduino15\packages\arduino\tools\avr-gcc\4.9.2-atmel3.5.4-arduino2/bin/avr-gcc returned 1 exit status

c:/users/chris vahi/appdata/local/arduino15/packages/arduino/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/../lib/gcc/avr/4.9.2/../../../../avr/bin/ld.exe: error: lto-wrapper failed

collect2.exe: error: ld returned 1 exit status

exit status 1
unrecognizable insn:

***********************************************************************************************************************
***********************************************************************************************************************
***********************************************************************************************************************
Start faulty code
***********************************************************************************************************************
***********************************************************************************************************************
**************************************************************************************************************************

bool gcode_M45(bool onlyZ, int8_t verbosity_level)
{
bool final_result = false;
#ifdef TMC2130
FORCE_HIGH_POWER_START;
#endif // TMC2130
// Only Z calibration?
if (!onlyZ)
{
setTargetBed(0);
setTargetHotend(0, 0);
setTargetHotend(0, 1);
setTargetHotend(0, 2);
adjust_bed_reset(); //reset bed level correction
}

// Disable the default update procedure of the display. We will do a modal dialog.
lcd_update_enable(false);
// Let the planner use the uncorrected coordinates.
mbl.reset();
// Reset world2machine_rotation_and_skew and world2machine_shift, therefore
// the planner will not perform any adjustments in the XY plane.
// Wait for the motors to stop and update the current position with the absolute values.
world2machine_revert_to_uncorrected();
// Reset the baby step value applied without moving the axes.
babystep_reset();
// Mark all axes as in a need for homing.
memset(axis_known_position, 0, sizeof(axis_known_position));

// Home in the XY plane.
//set_destination_to_current();
setup_for_endstop_move();
lcd_display_message_fullscreen_P(_T(MSG_AUTO_HOME));
home_xy();

enable_endstops(false);
current_position[X_AXIS] += 5;
current_position[Y_AXIS] += 5;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS] / 40, active_extruder);
st_synchronize();

// Let the user move the Z axes up to the end stoppers.
#ifdef TMC2130
if (calibrate_z_auto())
{
#else //TMC2130
if (lcd_calibrate_z_end_stop_manual(onlyZ))
{
#endif //TMC2130
refresh_cmd_timeout();
#ifndef STEEL_SHEET
if (((degHotend(0) > MAX_HOTEND_TEMP_CALIBRATION) || (degBed() > MAX_BED_TEMP_CALIBRATION)) && (!onlyZ))
{
lcd_wait_for_cool_down();
}
#endif //STEEL_SHEET
if (!onlyZ)
{
KEEPALIVE_STATE(PAUSED_FOR_USER);
#ifdef STEEL_SHEET
bool result = lcd_show_fullscreen_message_yes_no_and_wait_P(_T(MSG_STEEL_SHEET_CHECK), false, false);
if (result) lcd_show_fullscreen_message_and_wait_P(_T(MSG_REMOVE_STEEL_SHEET));
#endif //STEEL_SHEET
lcd_show_fullscreen_message_and_wait_P(_T(MSG_CONFIRM_NOZZLE_CLEAN));
lcd_show_fullscreen_message_and_wait_P(_T(MSG_PAPER));
KEEPALIVE_STATE(IN_HANDLER);
lcd_display_message_fullscreen_P(_T(MSG_FIND_BED_OFFSET_AND_SKEW_LINE1));
lcd_implementation_print_at(0, 2, 1);
lcd_printPGM(_T(MSG_FIND_BED_OFFSET_AND_SKEW_LINE2));
}
// Move the print head close to the bed.
current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;

bool endstops_enabled = enable_endstops(true);
#ifdef TMC2130
tmc2130_home_enter(Z_AXIS_MASK);
#endif //TMC2130

plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS] / 40, active_extruder);

st_synchronize();
#ifdef TMC2130
tmc2130_home_exit();
#endif //TMC2130
enable_endstops(endstops_enabled);

if (st_get_position_mm(Z_AXIS) == MESH_HOME_Z_SEARCH)
{

int8_t verbosity_level = 0;
if (code_seen('V'))
{
// Just 'V' without a number counts as V1.
char c = strchr_pointer[1];
verbosity_level = (c == ' ' || c == '\t' || c == 0) ? 1 : code_value_short();
}

if (onlyZ)
{
clean_up_after_endstop_move();
// Z only calibration.
// Load the machine correction matrix
world2machine_initialize();
// and correct the current_position to match the transformed coordinate system.
world2machine_update_current();
//FIXME
bool result = sample_mesh_and_store_reference();
if (result)
{
if (calibration_status() == CALIBRATION_STATUS_Z_CALIBRATION)
// Shipped, the nozzle height has been set already. The user can start printing now.
calibration_status_store(CALIBRATION_STATUS_CALIBRATED);
final_result = true;
// babystep_apply();
}
}
else
{
// Reset the baby step value and the baby step applied flag.
calibration_status_store(CALIBRATION_STATUS_XYZ_CALIBRATION);
eeprom_update_word((uint16_t*)EEPROM_BABYSTEP_Z, 0);
// Complete XYZ calibration.
uint8_t point_too_far_mask = 0;
BedSkewOffsetDetectionResultType result = find_bed_offset_and_skew(verbosity_level, point_too_far_mask);
clean_up_after_endstop_move();
// Print head up.
current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS] / 40, active_extruder);
st_synchronize();
//#ifndef NEW_XYZCAL
if (result >= 0)
{
#ifdef HEATBED_V2
sample_z();
#else //HEATBED_V2
point_too_far_mask = 0;
// Second half: The fine adjustment.
// Let the planner use the uncorrected coordinates.
mbl.reset();
world2machine_reset();
// Home in the XY plane.
setup_for_endstop_move();
home_xy();
result = improve_bed_offset_and_skew(1, verbosity_level, point_too_far_mask);
clean_up_after_endstop_move();
// Print head up.
current_position[Z_AXIS] = MESH_HOME_Z_SEARCH;
plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], homing_feedrate[Z_AXIS] / 40, active_extruder);
st_synchronize();
// if (result >= 0) babystep_apply();
#endif //HEATBED_V2
}
//#endif //NEW_XYZCAL
lcd_update_enable(true);
lcd_update(2);

lcd_bed_calibration_show_result(result, point_too_far_mask);
if (result >= 0)
{
// Calibration valid, the machine should be able to print. Advise the user to run the V2Calibration.gcode.
calibration_status_store(CALIBRATION_STATUS_LIVE_ADJUST);
if (eeprom_read_byte((uint8_t*)EEPROM_WIZARD_ACTIVE) != 1) lcd_show_fullscreen_message_and_wait_P(_T(MSG_BABYSTEP_Z_NOT_SET));
final_result = true;
}
}
#ifdef TMC2130
tmc2130_home_exit();
#endif
}
else
{
lcd_show_fullscreen_message_and_wait_P(PSTR("Calibration failed! Check the axes and run again."));
final_result = false;
}
}
else
{
// Timeouted.
}
lcd_update_enable(true);
#ifdef TMC2130
FORCE_HIGH_POWER_END;
#endif // TMC2130
return final_result;

}

Posted : 23/07/2018 4:16 am
DJ
 DJ
(@dj-6)
Trusted Member
Re: Error Compiling 3.3.1

After adding the 'volatile' keyword to the code as described below, I have been successfully compiling with a much more recent Arduino IDE 1.8.5. Hope this helps.
DJ


diff --git a/Firmware/xyzcal.cpp b/Firmware/xyzcal.cpp
index ed3d321..a59f489 100644
--- a/Firmware/xyzcal.cpp
+++ b/Firmware/xyzcal.cpp
@@ -32,7 +32,7 @@

#define _PI 3.14159265F

-extern long count_position[NUM_AXIS];
+extern volatile long count_position[NUM_AXIS];

uint8_t check_pinda_0();
uint8_t check_pinda_1();

DJ

Posted : 24/07/2018 1:43 am
chris.h37
(@chris-h37)
New Member
Topic starter answered:
Re: Error Compiling 3.3.1

After adding the 'volatile' keyword to the code as described below, I have been successfully compiling with a much more recent Arduino IDE 1.8.5. Hope this helps.
DJ

That worked beautifully! Thank you very much @djspathis! In case someone else can benefit from this fix, the line is line 35 of xyzcal.cpp on my copy of 3.3.1. For some reason searching by code line got me no results.

Posted : 30/07/2018 11:22 pm
Peter in Katy
(@peter-in-katy)
Estimable Member
Re: Error Compiling 3.3.1

Before I do something stupid, my Export binary hex for is 637k.
The downloaded prusa compiled firmware is just over 800k.

I didn't change a thing in the .CPP files except adding volatile. I want to be able to compile/not crash my printer before I screw with the code to crash my printer 😀

Posted : 31/07/2018 1:43 am
DJ
 DJ
(@dj-6)
Trusted Member
Re: Error Compiling 3.3.1

I've just been looking at the hex output for my 1.8.5 IDE version vs the hex file Prusa supplied. (thank you Srecord!) While I've only had a quick look, it does not appear as if any large chunks are missing from my smaller hex file (619K) vs Prusa (807K). This is with v3.3.1 from last week that I compiled and am using on my MK3. This is by no means a guarantee of correctness. I'm simply saying that the 1.8.5 IDE allows me to compile the Prusa code and run it on my MK3.

Now as to why it might compile to a smaller size I have only a guess. Could it be that the improvements in the newer IDE include an updated compiler that produces more efficient code? My 1.8.5 compiled Sketch uses 225100 bytes of program memory. Does anyone have a number for 1.6.8 to compare with?

DJ

DJ

Posted : 01/08/2018 4:33 am
DJ
 DJ
(@dj-6)
Trusted Member
Re: Error Compiling 3.3.1

I've just been looking at the hex output for my 1.8.5 IDE version vs the hex file Prusa supplied. (thank you Srecord!) While I've only had a quick look, it does not appear as if any large chunks are missing from my smaller hex file (619K) vs Prusa (807K). This is with v3.3.1 from last week that I compiled and am using on my MK3. This is by no means a guarantee of correctness. I'm simply saying that the 1.8.5 IDE allows me to compile the Prusa code and run it on my MK3.

Now as to why it might compile to a smaller size I have only a guess. Could it be that the improvements in the newer IDE include an updated compiler that produces more efficient code? My 1.8.5 compiled Sketch uses 225100 bytes of program memory. Does anyone have a number for 1.6.8 to compare with?

DJ

DJ

Posted : 01/08/2018 4:33 am
chris.h37
(@chris-h37)
New Member
Topic starter answered:
Re: Error Compiling 3.3.1

Before I do something stupid, my Export binary hex for is 637k.
The downloaded prusa compiled firmware is just over 800k.

I didn't change a thing in the .CPP files except adding volatile. I want to be able to compile/not crash my printer before I screw with the code to crash my printer 😀

There is something else in the Prusa OEM code the is not released in the open source version. I've had a couple versions give me a warning about not being factory approved code after alterations. If you're worried you can always revert to the stock code after making alterations that don't work out. That's the beauty of open firmware. The volatile modification worked perfectly for me. Though I continue to have a weird acceleration or federate problem only on the z lift during the homing sequence.

Posted : 08/08/2018 8:33 am
Share: