<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>LeafLabs Garden &#187; Topic: Eclipse + LibMaple + Project without copying entire libmaple</title>
		<link>http://forums.leaflabs.com/topic.php?id=1908</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:13:29 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://forums.leaflabs.com/search.php</link>
		</textInput>
		<atom:link href="http://forums.leaflabs.com/rss.php?topic=1908" rel="self" type="application/rss+xml" />

		<item>
			<title>stafil on "Eclipse + LibMaple + Project without copying entire libmaple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1908#post-28377</link>
			<pubDate>Fri, 09 Aug 2013 02:44:37 +0000</pubDate>
			<dc:creator>stafil</dc:creator>
			<guid isPermaLink="false">28377@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;pls write complete steps how settings libmaple eclipse for windows.&#60;br /&#62;
thx
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Sacdarius on "Eclipse + LibMaple + Project without copying entire libmaple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1908#post-17345</link>
			<pubDate>Thu, 27 Sep 2012 14:37:20 +0000</pubDate>
			<dc:creator>Sacdarius</dc:creator>
			<guid isPermaLink="false">17345@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi i tried the example project. I get stuck at this:&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;&#34;To save typing, there's a shell script, make-helper.sh, that you can&#60;br /&#62;
call which just runs the above command line, and passes any additional&#60;br /&#62;
arguments along to make (note: it puts the build path in the directory&#60;br /&#62;
you call it from)&#34;
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;How do i call this script?&#60;/p&#62;
&#60;p&#62;I'm using win64bit pro and Eclipse juno.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>lostinspacebar on "Eclipse + LibMaple + Project without copying entire libmaple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1908#post-11286</link>
			<pubDate>Fri, 15 Jun 2012 09:16:27 +0000</pubDate>
			<dc:creator>lostinspacebar</dc:creator>
			<guid isPermaLink="false">11286@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Wow that's a lot cleaner than my method of setting like 723472394832 build variables in eclipse. &#60;/p&#62;
&#60;p&#62;I was actually setting all the variables by looking at what the regular libmaple build was doing, but I was doing it by trying to go through the Makefiles. Would have been smarter to just do the verbose build as you suggested. :)&#60;/p&#62;
&#60;p&#62;Thanks a lot for the example project. Will try it out.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mbolivar on "Eclipse + LibMaple + Project without copying entire libmaple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1908#post-11281</link>
			<pubDate>Thu, 14 Jun 2012 22:50:09 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">11281@http://forums.leaflabs.com/</guid>
			<description>&#60;blockquote&#62;&#60;p&#62;
2. Piggyback on our build system so you can keep a single copy of libmaple, but tell it to include your project sources in the build.&#60;/p&#62;
&#60;p&#62;I'm not an Eclipse user, but I think that option (2) plus telling Eclipse to just use our Makefile is probably the quickest way to get what you want. I'll write up a quick tutorial on how and put it on the wiki, then update this thread once I'm done.
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;Actually, I think working example code is better than a tutorial, so I've pushed a patch to the libmaple build system which makes it easier to do out-of-tree projects:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;https://github.com/leaflabs/libmaple/commit/be75a466b7048b8a4024714f78e65a9b3f1a8836&#34; rel=&#34;nofollow&#34;&#62;https://github.com/leaflabs/libmaple/commit/be75a466b7048b8a4024714f78e65a9b3f1a8836&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;And I made an example repository you can use when starting a new project:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;https://github.com/mbolivar/example-libmaple-project&#34; rel=&#34;nofollow&#34;&#62;https://github.com/mbolivar/example-libmaple-project&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Check out README.txt for more.&#60;/p&#62;
&#60;p&#62;Note that this is NOT AN OFFICIAL LEAFLABS REPOSITORY. It's available from my personal GitHub account. Since the libmaple build system is a moving target, it might get stale. I promise to do my best to keep it up to date, though.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mbolivar on "Eclipse + LibMaple + Project without copying entire libmaple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1908#post-11279</link>
			<pubDate>Thu, 14 Jun 2012 19:47:18 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">11279@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;oh, and one more thing: an existing Makefile that uses our scripts is here:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;https://github.com/Ixox/preen/blob/master/Makefile&#34; rel=&#34;nofollow&#34;&#62;https://github.com/Ixox/preen/blob/master/Makefile&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mbolivar on "Eclipse + LibMaple + Project without copying entire libmaple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1908#post-11277</link>
			<pubDate>Thu, 14 Jun 2012 19:18:17 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">11277@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;by the way, the &#34;short answer&#34; for how to piggyback on our build system is:&#60;/p&#62;
&#60;p&#62;1. write a rules.mk for your project. use e.g. libraries/FreeRTOS/rules.mk as an example.&#60;br /&#62;
2. tell libmaple about your sources by making it treat them as a module. do this by providing an initial LIBMAPLE_MODULES in the call to make, and using our makefile. you also need to set the LIB_MAPLE_HOME variable, either on the command line or in the environment. hypothetical series of commands that should work on Linux (i realize you're on Windows, but i don't have a Windows machine handy. i'll also test these commands with an example project that'll be linked to in the tutorial):&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;$ cd /path/to/your/project
$ emacs rules.mk # then write rules.mk
$ make -f /path/to/libmaple/Makefile LIBMAPLE_MODULES=/path/to/your/project LIB_MAPLE_HOME=/path/to/libmaple
$ ls build/maple.bin # this is what you upload&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>mbolivar on "Eclipse + LibMaple + Project without copying entire libmaple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1908#post-11276</link>
			<pubDate>Thu, 14 Jun 2012 19:08:41 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">11276@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Yes, it definitely sounds like your linker setup is not putting things in the right places.&#60;/p&#62;
&#60;p&#62;Other possible problems: the libmaple headers rely on the environment to provide a bunch of #defines (like what board you're using, etc.), so you can't just configure Eclipse to tell GCC where to find the headers and call it a day. You can see the extra flags by doing a verbose libmaple build. For example, &#60;code&#62;$ make V=1 library&#60;/code&#62; will build libmaple.a in verbose mode, so you can see all the extra stuff GCC needs to know. For example, on my machine, the output for a C++ file looks like this:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;arm-none-eabi-g++ -Os -g3 -gdwarf-2  -mcpu=cortex-m3 -mthumb -march=armv7-m -nostdlib -ffunction-sections -fdata-sections -Wl,--gc-sections -DVECT_TAB_FLASH -DBOARD_maple -DMCU_STM32F103RB -DERROR_LED_PORT=GPIOA -DERROR_LED_PIN=5 -DSTM32_MEDIUM_DENSITY -I/home/mbolivar/leaf/libmaple/wirish [... other -I omitted ...] -I/home/mbolivar/leaf/libmaple/wirish -fno-rtti -fno-exceptions -Wall -DVECT_TAB_FLASH -DBOARD_maple -DMCU_STM32F103RB -DERROR_LED_PORT=GPIOA -DERROR_LED_PIN=5 -DSTM32_MEDIUM_DENSITY  -MMD -MP -MF build//home/mbolivar/leaf/libmaple/wirish/boards.d -MT build//home/mbolivar/leaf/libmaple/wirish/boards.o -o build//home/mbolivar/leaf/libmaple/wirish/boards.o -c /home/mbolivar/leaf/libmaple/wirish/boards.cpp&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;Notice things like &#60;code&#62;-DVECT_TAB_FLASH&#60;/code&#62;, &#60;code&#62;-DSTM32_MEDIUM_DENSITY&#60;/code&#62;, etc. in addition to the include directories.&#60;/p&#62;
&#60;p&#62;Anyway. Packaging libmaple for distribution, and generally writing projects outside of the libmaple tree, is definitely a deficiency that we need to correct. Until a better solution is provided, you have two choices:&#60;/p&#62;
&#60;p&#62;1. Use libmaple's &#34;library&#34; makefile target to get build/libmaple.a compiled with all of our flags, build your application separately, and then use our linker script to put everything together.&#60;/p&#62;
&#60;p&#62;2. Piggyback on our build system so you can keep a single copy of libmaple, but tell it to include your project sources in the build.&#60;/p&#62;
&#60;p&#62;I'm not an Eclipse user, but I think that option (2) plus telling Eclipse to just use our Makefile is probably the quickest way to get what you want. I'll write up a quick tutorial on how and put it on the wiki, then update this thread once I'm done.&#60;/p&#62;
&#60;p&#62;The important thing is that you need to use our linker script(s) and provide the appropriate linker flags so that it works. Again, I'm not an Eclipse user, but it sounds like the makefiles it generated aren't what you want. If the link goes wrong, then e.g. the vector table will be incorrect, and the reset vector won't point to _start (which is the assembly stub that sets up the call to start_c()). The linker script does other important things too, like provide symbols so start_c() knows how to initialize .data and .bss. If you link against libmaple in a way that violates the assumptions made in that script, Bad Things happen.&#60;/p&#62;
&#60;p&#62;For an example call to the linker, you can again build some example in verbose mode. For example (on Linux):&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;$ ln -s examples/blinky.cpp main.cpp
$ make V=1 &#124; grep Xlinker&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;The pipe to grep hides all the output except for the call to the linker. On my machine, that produces this output:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;arm-none-eabi-g++ -T/home/mbolivar/leaf/libmaple/support/ld/maple/flash.ld -L/home/mbolivar/leaf/libmaple/support/ld -mcpu=cortex-m3 -mthumb -Xlinker -L /home/mbolivar/leaf/libmaple/support/ld/stm32/f1/performance --gc-sections --print-gc-sections --march=armv7-m -Wall -o build/maple.elf  build//home/mbolivar/leaf/libmaple/libmaple/adc.o [ ... many object files omitted ... ] build/main.o -Wl,-Map,build/maple.map&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;The -T flag specifies the linker script. The -L flags specify search directories for ancillary linker script files.&#60;/p&#62;
&#60;p&#62;Ok, off to write that tutorial; hopefully I'll update this thread soon.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>lostinspacebar on "Eclipse + LibMaple + Project without copying entire libmaple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1908#post-11275</link>
			<pubDate>Thu, 14 Jun 2012 17:31:31 +0000</pubDate>
			<dc:creator>lostinspacebar</dc:creator>
			<guid isPermaLink="false">11275@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;So I am trying to setup a system so I can have a single libmaple.a and just use it (while pointing to include directories) in projects that have my own code (and nothing else). &#60;/p&#62;
&#60;p&#62;I've setup eclipse so far to compile libmaple as a library on windows. I've put this up as an Eclipse project on bitbucket : &#60;a href=&#34;https://bitbucket.org/lostinspacebar/libmaple-windows&#34; rel=&#34;nofollow&#34;&#62;https://bitbucket.org/lostinspacebar/libmaple-windows&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;I've also setup a second project that is just a main.cpp and has include directories and libraries for linker setup (letting Eclipse generate it's own makefiles). And stuff does compile and I get a maple.bin. When I program this using dfu-util though, nothing happens on the board. The LED is supposed to blink, but nothing happens. So I'm thinking something is amiss with the startup. I noticed the linker map looks for start_c and this symbol does exist in my disassembly so not sure what else I need. The dissassemblies are here:&#60;/p&#62;
&#60;p&#62;My method where libmaple is compiled separately and used as a static library in a C project (doesn't work):&#60;br /&#62;
&#60;a href=&#34;https://dl.dropbox.com/u/4371300/stasis.disas&#34; rel=&#34;nofollow&#34;&#62;https://dl.dropbox.com/u/4371300/stasis.disas&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;The method where libmaple is copied and main.cpp.example is renamed and modified (works):&#60;br /&#62;
&#60;a href=&#34;https://dl.dropbox.com/u/4371300/maple.disas&#34; rel=&#34;nofollow&#34;&#62;https://dl.dropbox.com/u/4371300/maple.disas&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;If I compare the dissassembly from my method to the one where you just edit the main.cpp that comes with libmaple (and compile as sketch), the start_c symbol starts at a different memory address. Could this be a problem? My disassembly is also about 1/2 the size... &#60;/p&#62;
&#60;p&#62;Any help / pointers would be very appreciated. I really don't want to make a copy of libmaple every time I start a project. I also don't want to have to package the libmaple source with all my projects. &#60;/p&#62;
&#60;p&#62;Thanks,&#60;br /&#62;
Aditya
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
