MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.34k stars 19.26k forks source link

[BUG] Enabling M100 causes compile error with LPC1768 #13947

Closed Zol-Tank closed 5 years ago

Zol-Tank commented 5 years ago

Description

Enabling M100_FREE_MEMORY_WATCHER using LPC1768 results in a compile error.

Steps to Reproduce

  1. Set environment to LPC1768
  2. Enable M100_FREE_MEMORY_WATCHER
  3. Compile

Expected behavior: Successful compile and M100 usable.

Actual behavior: Error during compile.

Additional Information

Marlin.zip

Bob-the-Kuhn commented 5 years ago

It looks like M100 is useable only with the AVR chips. Compiling for LPC1768 and DUE results in different names for the referenced variables/definitions.

Is there a problem you're trying to troubleshoot?

Zol-Tank commented 5 years ago

There isn't a problem I'm trying to troubleshoot, but with my new 32 bit boards I've gone kind of crazy with my enabled features and buffer sizes, and I just wanted to make sure I wasn't using too much memory. The Arduino IDE very helpfully tells me my memory usage upon compiling, but Atom doesn't (at least not that I can see), so I thought M100 would be a good way to do it.

Roxy-3D commented 5 years ago

The tweaks to get M100 working on 32-bit platforms should not be very much. The problem is I'm not setup to do 32-bit stuff right now. Finding the embedded variables from the link map should not be that hard if somebody is setup to do that.

ManuelMcLure commented 5 years ago

On VSCode PIO does show the memory usage, but it's not at the very end of the output - it's a few dozen lines higher, above the list of platforms with [SKIP]/[ERROR]/[SUCCESS]. I would expect that Atom PIO also shows it.

Bob-the-Kuhn commented 5 years ago

Yes, PlatformIO shows the memory usage as stated above. PIO's output is the same on all platforms.

Roxy-3D commented 5 years ago

You know... M100 gives you memory information that the linker can't give you.
We should get M100 working on 32-bit platforms.

robbycandra commented 5 years ago

Fix on PR #13957

ghost commented 5 years ago

Fix on PR #13957

After applying that fix @robbycandra, I get this compile error for my SKR 1.3 LPC1768 board (Atom/platformio) ..

==================

Compiling .pioenvs\LPC1768\src\src\gcode\gcode.cpp.o

Linking .pioenvs\LPC1768\firmware.elf

c:/users/#####/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: .pioenvs/LPC1768/src/src/gcode/calibrate/M100.cpp.o: in function `check_for_free_memory_corruption(char const*)':

C:\Projects\3D Printer\Marlin 2\mine/Marlin\src\gcode\calibrate/M100.cpp:210: undefined reference to `__brkval'

c:/users/#####/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: C:\Projects\3D Printer\Marlin 2\mine/Marlin\src\gcode\calibrate/M100.cpp:210: undefined reference to `__bss_end'

c:/users/#####/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: .pioenvs/LPC1768/src/src/gcode/calibrate/M100.cpp.o: in function `GcodeSuite::M100()':

C:\Projects\3D Printer\Marlin 2\mine/Marlin\src\gcode\calibrate/M100.cpp:326: undefined reference to `__brkval'

c:/users/#####/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/8.2.1/../../../../arm-none-eabi/bin/ld.exe: C:\Projects\3D Printer\Marlin 2\mine/Marlin\src\gcode\calibrate/M100.cpp:326: undefined reference to `__bss_end'

collect2.exe: error: ld returned 1 exit status

==================

robbycandra commented 5 years ago

@doggyfan , I think thats not because of my PR.

robbycandra commented 5 years ago

My PR fix compile error if we enable M100_FREE_MEMORY_WATCHER, but disable M100_FREE_MEMORY_DUMPER.

Bob-the-Kuhn commented 5 years ago

I just created PR #13962 with an M100 that works with LPC1768 and SAM3X8E boards.

I did have to add fudge factors to keep out of some areas that the symbol tables implied were safe/unused. I think the DUE has some sort of memory protection for the RAM that has the stack as accessing that area results in an immediate reset.

Bob-the-Kuhn commented 5 years ago

PR #13962 has been merged.

Please close this issue if the new code works.

boelle commented 5 years ago

Lack of Activity This issue is being closed due to lack of activity. If you have solved the issue, please let us know how you solved it. If you haven't, please tell us what else you've tried in the meantime, and possibly this issue will be reopened.

github-actions[bot] commented 4 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.