Welcome! Log In Create A New Profile

Advanced

Compiling RepRapFirmware on Linux without Eclipse

Posted by 3D-ES 
Re: Compiling RepRapFirmware on Linux without Eclipse
April 10, 2016 03:08PM
Quote
chrishamm
See my firmware fork at [github.com], it provides a typical Makefile and a build script for Windows. Just make sure you install my Arduino Duet board before you attempt to compile it (requires the latest Arduino version). I managed to get it to compile with dc42's fork as well, but I haven't tried that with his latest firmware version yet.

ah very cool, thanks chris. 3D-ES's script "just worked" - took literally minutes, so as a "i got it compiled to get started" i'm done. if i need to begin making any mods i know where to start - with the Makefile you created - and it'll definitely be with a Makefile. *thumbs-up*.
Re: Compiling RepRapFirmware on Linux without Eclipse
April 10, 2016 05:16PM
I have just checked in a major new revision of my fork, version 1.11. The directory structure has changed substantially to more easily support alternative electronics, including the next-generation Duet. Most of the hardware-dependent bits are in a separate project, CoreNG (which replaces CoreDuet, which in turn replaced the Arduino core).

So I invite anyone with an interest to generate makefiles for this new structure. I can supply the ones auto-generated by Eclipse if that helps.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Compiling RepRapFirmware on Linux without Eclipse
April 11, 2016 07:22AM
Quote
lkcl
smiling smiley appreciated, dave - i have a macbook pro running Debian, with a 250gb SSD, i'm a little reluctant to open it up. i used to build my own PCs [i've done around 50] - but laptops... i've seen the horror stories of people puncturing the laptop battery from apple macbooks.... i'm really reluctant to take the risk. nice thought, though.

In that case:-
[www.amazon.co.uk]
[www.amazon.co.uk]

;-)
Dave
Re: Compiling RepRapFirmware on Linux without Eclipse
April 11, 2016 04:23PM
Quote
dc42
Great! Thanks for taking the trouble to support my fork. I'm still hoping that we can get back to a single RepRapFirmware sometime.

... i don't know how long people here have been working with software libre, i was lucky enough to go to imperial college in 1988, and so had access to HP/UX systems (donated in 1989), micro-vaxes, SunOS 4.1.3 systems and so on. we used rcs (!) which was the first time i ever encountered revision control.

rcs really sucked, it was definitely single-user, and it wasn't until 1996 when i started working with samba that i encountered "concurrent" version control - cvs. with people doing ssh into samba.anu.edu.au we could collaborate. the project leader basically sorted out any screw-ups, and he was the sysadmin as well, so we all "behaved" otherwise he'd revoke our ssh access. then along came subversion, which was web-based, and a little bit more featureful. then, after linus torvalds had a falling-out with the proprietary bitkeeper company he did what he should have done all along, and used software libre revision tools. but, being linus, he started writing his own tool.... git.

now, the deployments of git when it first came out were on top of things like the alexandria project (sourceforge's project "1" - which you only now see on savannah and other sites rapidly going into obscurity) - and *all* of those sites were based around *groups*.

basically there was a team leader or leaders, they were the ones that, usually, had started the project, they were the ones in charge, and they sorted out all the arguments - in a good way or a bad way - but they got things sorted. everyone deferred to their judgement, and, crucially, they were a focal-point to attract new people to the project.

so, up until around 2006, every single software libre project out there was set up in such a way that teamwork and collaboration was both implied and expected.

then... along came the proprietary "let's collect meta data and sell it to advertisers and pretend we're valuable" company known as "github", which basically made the *individual* the number one priority, *not* the team. there *is* no "team" in "github". there's no project management, no admins, no group permissions - nothing. everybody is "democratised" to "equals".

and that's where it's gone desperately, desperately wrong - not just for RepRapFirmware but for a whole bunch of software libre projects. with no implicit encouragement of teamwork by way of the web hosting for RepRapFirmware, nobody has been encouraged to step up to the role of "project leader". there's no focus.

if this isn't clear, perhaps it can be made clear by the following question: *where* is the canonical web site where i am supposed to submit patches, knowing that, by doing so, they will end up reliably being down-stream, forever, across all branches? there isn't one, is there? why? because there's half a dozen different people - each with extremely valuable specialised knowledge and skills - each of whom has been forced to fork RepRapFirmware - each of whom is respected for what they've contributed, but precisely because they are individually given such respect and equal priority, *none* of them can claim to be "The" de-facto project leader, coordinator and patch-manager / merger / rejector / other.

this is why i stopped using github. i closed the account. i've always, always run things like gitolite, off my own server, or used sourceforge, or savannah, or alioth, precisely because that then invites people to contact me and say "hey, can i please have an account, i've got some patches to submit". i then just... let them get on with it, and occasionally write to them saying "you made a mistake, here, could you please sort it out". and it worked! people self-managed, with a little prompting.

.. but someone has to step up to that role. also, the best and clearest indicator is to *stop* referring people to the github repositories, and to refer people to a specially-created repository whose sole purpose is to make it clear that it's the "canonical" repository. then you either add some automated scripts that regularly do a "git pull" in from the invididual forkers github repos, or give them access and let them do "git push" manually when they are ready to do so. on the various projects that i managed, i was i think the only person who *didn't* use github - everyone else would be working on code on github then do a "git push" to the central repository once they were happy with what they'd done.

it worked extremely well, and it's what RepRapFirmware - and Marlin - and many other software libre projects - are completely missing.
Re: Compiling RepRapFirmware on Linux without Eclipse
May 22, 2016 03:23PM
Does anyone have a makefile for linux/osx that works with the recent versions 1.11 or 1.12 of David's fork? - I had tried to compile earlier (March, version 1.09 I believe) had given up after a week of failures and a lot of pain with Eclipse on a Mac. Tried again for two days just now (using Eclipse) with the new build instructions from David, but gave up again.
Peter

Edited 1 time(s). Last edit at 05/22/2016 03:23PM by peterl.
Re: Compiling RepRapFirmware on Linux without Eclipse
May 22, 2016 05:10PM
What problems were you having with the Eclipse build? It's a lot simpler and more reliable now that it doesn't use the Arduino plug in.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Compiling RepRapFirmware on Linux without Eclipse
May 22, 2016 05:56PM
I wish I could describe a concrete problem or ask a reasonable question. At the moment I would be wasting your time.

I am simply not used to Eclipse and I don't seem to be able to translate your build instructions into Eclipse Juno on a Mac. - Only some of my path definitions work as they should, others don't for a reason that is not at all apparent to me.

Here some of the build output:
Cannot run program "/usr/bin/arm-none-eabi-g++": Unknown reason
I know the reason: It's not there, because it is in a different path that I have specified:
PATH=[/usr/bin;/Users/Peter/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin]
Unfortunately I cannot get Eclipse to look there. Maybe I should just create a bunch of symlinks.

I think I am just not experienced enough with Eclipse to figure out where in the properties I have to set what. Hence the request for the makefile.

Full console output from build:
22:25:26 **** Incremental Build of configuration Release for project RepRapFirmware ****
Info: Internal Builder is used for build
/usr/bin/arm-none-eabi-g++ -D__SAM3X8E__ -DF_CPU=84000000 -DUSBCON -DUSB_PID=0x003e -DUSB_VID=0x2341 -Dprintf=iprintf -I/Users/Peter/cnc-firmware/ECLIPSE/CoreDuet/cores/arduino -I/Users/Peter/cnc-firmware/ECLIPSE/CoreDuet/system/libsam -I/Users/Peter/cnc-firmware/ECLIPSE/CoreDuet/system/CMSIS/Device/ATMEL -I/Users/Peter/cnc-firmware/ECLIPSE/CoreDuet/system/CMSIS/CMSIS/Include -I/Users/Peter/cnc-firmware/ECLIPSE/CoreDuet/variants/duet -I/Users/Peter/cnc-firmware/ECLIPSE/CoreDuet/system/libsam/include -I/Users/Peter/cnc-firmware/ECLIPSE/RepRapFirmware/Libraries/Lwip -I/Users/Peter/cnc-firmware/ECLIPSE/RepRapFirmware/Libraries/EMAC -I/Users/Peter/cnc-firmware/ECLIPSE/RepRapFirmware/Libraries/SamNonDuePin -I/Users/Peter/cnc-firmware/ECLIPSE/RepRapFirmware/Libraries/SD_HSMCI -I/Users/Peter/cnc-firmware/ECLIPSE/RepRapFirmware/Libraries/SD_HSMCI/utility -I/Users/Peter/cnc-firmware/ECLIPSE/RepRapFirmware/Libraries/SPI -I/Users/Peter/cnc-firmware/ECLIPSE/RepRapFirmware/Libraries/MAX31855 -I/Users/Peter/cnc-firmware/ECLIPSE/RepRapFirmware/Libraries/MCP4461 -I/Users/Peter/cnc-firmware/ECLIPSE/RepRapFirmware/Libraries/Flash -I/Users/Peter/cnc-firmware/ECLIPSE/RepRapFirmware/Libraries/Wire -O2 -Wall -c -std=gnu++11 -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections -fno-threadsafe-statics -fno-rtti -fno-exceptions -nostdlib --param max-inline-insns-single=500 -o src/OutputMemory.o ../src/OutputMemory.cpp 
Cannot run program "/usr/bin/arm-none-eabi-g++": Unknown reason

Error: Program "/usr/bin/arm-none-eabi-g++" not found in PATH
PATH=[/usr/bin;/Users/Peter/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin]


22:25:26 Build Finished (took 14ms)

Anyways. Thank you for willing to help. But don't waste your time on this. Eventually, given enough time,I will figure out what to set where. - And with a bit of luck someone has a makefile.
Re: Compiling RepRapFirmware on Linux without Eclipse
May 22, 2016 06:23PM
The command should be just arm-none-eabi-g++, Check your cross settings. Here are mine (they are for Windows, but I guess the Linux ones should be similar).





Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].

Re: Compiling RepRapFirmware on Linux without Eclipse
May 23, 2016 12:17PM
Thanks for your reply, David. My cross settings are equivalent to yours.

While writing this reply, I went through all path definitions again and realised that I had a semicolon in the path variable in my C/C++ build Environment variables, separating /usr/bin from the long path to the arduino subfolder. That was completely logical to me every time I was typing it but it should have been a colon! I would never have come up with that, if you hadn't replied to me forcing me to triple and quadruple check what I write smiling smiley

Wrong: PATH=[/usr/bin;/Users/Peter/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin]
Right: PATH=[/usr/bin:/Users/Peter/Library/Arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin]

Finally the binary compiles, I can sleep better and work on some changes for my "oversized" and very slightly concave print bed.

Thank you!
Re: Compiling RepRapFirmware on Linux without Eclipse
May 23, 2016 12:53PM
Quote
peterl
Finally the binary compiles, I can sleep better and work on some changes for my "oversized" and very slightly concave print bed.

What changes do you think are necessary for an oversized and slightly concave print bed? RRF already supports the M208 command to define the movement dimensions, and 5-point bed levelling to handle convex or concave apparent bed shape.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Compiling RepRapFirmware on Linux without Eclipse
May 23, 2016 02:05PM
5 point bed levelling works ok if the bed is concave around the center. In my case I have a bed looks a bit like that:

between X0 Y0 and X450 Y0 it is flat (<100um)
between X0 Y0 and X0Y450 it is relatively flat (~100um)
between X450 and Y450 it is relatively flat (~100um)
between X450 Y450 and X0Y450 it is warped (~300um).
The center of the bed is still relatively level with the first 3 points. The maximum curvature is somewhere on Y450.

What that means is that the triangle between the center of the bed, X450 Y450 and X0 Y450 needs to have a hypotenuse that it slightly curved in Z, which requires at least one additional point. So I thought I can sub-divide the square bed into 8 triangles (9 points) instead of 4. Will need to do some reading starting in Move::BarycentricCoordinates. Maybe I get somewhere. If not, I'll get out the hammer winking smiley

[2][3][4]
[1][8][5]
[0][7][6]
Re: Compiling RepRapFirmware on Linux without Eclipse
May 23, 2016 04:14PM
Quote
peterl
5 point bed levelling works ok if the bed is concave around the center. In my case I have a bed looks a bit like that:

between X0 Y0 and X450 Y0 it is flat (<100um)
between X0 Y0 and X0Y450 it is relatively flat (~100um)
between X450 and Y450 it is relatively flat (~100um)
between X450 Y450 and X0Y450 it is warped (~300um).
The center of the bed is still relatively level with the first 3 points. The maximum curvature is somewhere on Y450.

You could try putting the 5th bed levelling point at about X225 Y430 instead of at the centre of the bed. Or just get a new glass plate, preferably 4mm thick, from your local glass merchant.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Compiling RepRapFirmware on Linux without Eclipse
June 09, 2016 03:26PM
Thank you. I tried your suggestion moving the 5th point first (before posting anything here) but I wasn't happy with the result. I agree that a glass bed or in fact my other new aluminium bed that is currently living under my desk would likely solve the problem. - I like to play around a bit and see what I can adapt to my needs. The bed transform was just a good place to start because it had always been a bit of a black box for me.

Now, a couple of weeks after writing the change, I have finally got the time to try it out and write it up. Turns out that the 9 factor compensation works really well for me. - Not that I would recommend to work with a bed like mine. In fact I recommend David's suggestion (glass bed), especially when working with his IR sensor.

But in case anyone is interested in my minor change to the code, here it is. It works well in 1.10 and 1.13 beta 1.

In the move class (move.h) I changed the number of permitted corner points:
float baryXBedProbePoints[5];						// The X coordinates of the triangle corner points
float baryYBedProbePoints[5];						// The Y coordinates of the triangle corner points
float baryZBedProbePoints[5];						// The Z coordinates of the triangle corner points
to
float baryXBedProbePoints[9];						// The X coordinates of the triangle corner points
float baryYBedProbePoints[9];						// The Y coordinates of the triangle corner points
float baryZBedProbePoints[9];						// The Z coordinates of the triangle corner points
and added
private:
float Triangle9Z(float x, float y) const;					// Interpolate onto a triangular grid using 9 point calibration

In move.cpp I changed the BedTransform and InverseBedTransform functions. - I just added the case 9:, so that an S9 after the last G30 command in the bed.g file will use 9 points.
void Move::BedTransform(float xyzPoint[AXES]) const
{
	switch(numBedCompensationPoints)
	{
	case 0:
		break;

	case 3:
		xyzPoint[Z_AXIS] = xyzPoint[Z_AXIS] + aX*xyzPoint[X_AXIS] + aY*xyzPoint[Y_AXIS] + aC;
		break;

	case 4:
		xyzPoint[Z_AXIS] = xyzPoint[Z_AXIS] + SecondDegreeTransformZ(xyzPoint[X_AXIS], xyzPoint[Y_AXIS]);
		break;

	case 5:
		xyzPoint[Z_AXIS] = xyzPoint[Z_AXIS] + TriangleZ(xyzPoint[X_AXIS], xyzPoint[Y_AXIS]);
		break;
	case 9:
		xyzPoint[Z_AXIS] = xyzPoint[Z_AXIS] + Triangle9Z(xyzPoint[X_AXIS], xyzPoint[Y_AXIS]);
		break;
	default:
		reprap.GetPlatform()->Message(GENERIC_MESSAGE, "BedTransform: wrong number of sample points.");
	}
}

// Invert the bed transform BEFORE the axis transform
void Move::InverseBedTransform(float xyzPoint[AXES]) const
{
	switch(numBedCompensationPoints)
	{
	case 0:
		break;

	case 3:
		xyzPoint[Z_AXIS] = xyzPoint[Z_AXIS] - (aX*xyzPoint[X_AXIS] + aY*xyzPoint[Y_AXIS] + aC);
		break;

	case 4:
		xyzPoint[Z_AXIS] = xyzPoint[Z_AXIS] - SecondDegreeTransformZ(xyzPoint[X_AXIS], xyzPoint[Y_AXIS]);
		break;

	case 5:
		xyzPoint[Z_AXIS] = xyzPoint[Z_AXIS] - TriangleZ(xyzPoint[X_AXIS], xyzPoint[Y_AXIS]);
		break;
	case 9:
		xyzPoint[Z_AXIS] = xyzPoint[Z_AXIS] - Triangle9Z(xyzPoint[X_AXIS], xyzPoint[Y_AXIS]);
		break;
	default:
		reprap.GetPlatform()->Message(GENERIC_MESSAGE, "InverseBedTransform: wrong number of sample points.");
	}
}

and added the 9 point triangle interpolation.

float Move::Triangle9Z(float x, float y) const
{
	for (size_t i = 0; i < 8; i++)
	{
		size_t j = (i + 1) % 8;
		float l1, l2, l3;
		BarycentricCoordinates(i, j, 8, x, y, l1, l2, l3);
		if (l1 > TRIANGLE_ZERO && l2 > TRIANGLE_ZERO && l3 > TRIANGLE_ZERO)
		{
			return l1 * baryZBedProbePoints + l2 * baryZBedProbePoints[j] + l3 * baryZBedProbePoints[8];
		}
	}
	reprap.GetPlatform()->Message(GENERIC_MESSAGE, "Triangle interpolation: point outside all triangles!\n");
	return 0.0;
}


The bed.g file contains the following points P0-P8:

^
| [2] [3] [4]
|
Y[1] [8] [5]
|
| [0] [7] [6]
-----------X--------->

9 point calculation is initiated by G30 P8 Xxxx Yyyy Z-99999 S9
where xxx and yyy are the respective coordinates of P8.

I am sure there s a better way to integrate this that does not involve writing a new function. But in this way, it is more or less discrete from the rest.
Cheers,
Peter

Edited 1 time(s). Last edit at 06/09/2016 06:06PM by peterl.
Re: Compiling RepRapFirmware on Linux without Eclipse
September 24, 2016 01:49PM
There was a "typo" in the return line of the last code snippet due to something odd happening whenever I write [ i ] in this forum (without spaces). The correct code should read:

float Move::Triangle9Z(float x, float y) const
{
	for (size_t i = 0; i < 8; i++)
	{
		size_t j = (i + 1) % 8;
		float l1, l2, l3;
		BarycentricCoordinates(i, j, 8, x, y, l1, l2, l3);
		if (l1 > TRIANGLE_ZERO && l2 > TRIANGLE_ZERO && l3 > TRIANGLE_ZERO)
		{
			return l1 * baryZBedProbePoints[ i ] + l2 * baryZBedProbePoints[j] + l3 * baryZBedProbePoints[8];
		}
	}
	reprap.GetPlatform()->Message(GENERIC_MESSAGE, "Triangle interpolation: point outside all triangles!\n");
	return 0.0;
}
Re: Compiling RepRapFirmware on Linux without Eclipse
September 24, 2016 02:02PM
Thanks for your code.

I have plans to implement a generic grid-based bed compensation algorithm, which would compute the probe points automatically given the corner points and the number of points required. That won't happen for several weeks. In the mean time, other users may well find your code useful.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Compiling RepRapFirmware on Linux without Eclipse
November 12, 2016 09:08AM
Can't wait to see your grid bed levelling routine. My changes to your code are a bit lame compared to what you have planned with the grid levelling. Do you think the grid levelling will be part of firmware v1.17?
- I came back here once again with the intention to increase the bed levelling points to 17, which is overkill and not very good with just one center point. I failed to come up with a cheap way to do the grid levelling. Anyway, I will keep my eyes peeled for your algorithm.
Re: Compiling RepRapFirmware on Linux without Eclipse
November 12, 2016 01:38PM
...and this is why using a lot of points during bed levelling makes sense for me... can't believe I'm still using this bad bed. Unbelievable. Units are mm.


Edited 2 time(s). Last edit at 11/12/2016 01:39PM by peterl.
Re: Compiling RepRapFirmware on Linux without Eclipse
November 12, 2016 05:47PM
Quote
peterl
Can't wait to see your grid bed levelling routine. My changes to your code are a bit lame compared to what you have planned with the grid levelling. Do you think the grid levelling will be part of firmware v1.17?
- I came back here once again with the intention to increase the bed levelling points to 17, which is overkill and not very good with just one center point. I failed to come up with a cheap way to do the grid levelling. Anyway, I will keep my eyes peeled for your algorithm.

Grid bed compensation is planned to be one of the headlines in 1.17. I hope to start on it next week.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Sorry, only registered users may post in this forum.

Click here to login