<?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: Upload user code with USART</title>
		<link>http://forums.leaflabs.com/topic.php?id=1311</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:17:48 +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=1311" rel="self" type="application/rss+xml" />

		<item>
			<title>gbulmer on "Upload user code with USART"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1311#post-8139</link>
			<pubDate>Wed, 08 Feb 2012 12:24:55 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">8139@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;djk - objdump can be used in a simple way:&#60;br /&#62;
arm-none-eabi-objdump -d foo.elf&#60;/p&#62;
&#60;p&#62;It has lots of options, but you can ignore most of them.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>djk on "Upload user code with USART"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1311#post-8136</link>
			<pubDate>Wed, 08 Feb 2012 09:52:40 +0000</pubDate>
			<dc:creator>djk</dc:creator>
			<guid isPermaLink="false">8136@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;1. Great news on the windows 7.  I am going to test and document this and post howto &#38;amp; results i a new thread when i'm done.&#60;/p&#62;
&#60;p&#62;2-3. yes so what i'm looking for is a a text file listing the memory locations for each bit of code in codespace, variable in the dataspace etc. Probably most IDE's or makefiles i've worked with in the past had this text dump built in to the build process. I will do my homework on OBJDUMP, sounds like i can get what i need that way.&#60;/p&#62;
&#60;p&#62;Thanks again!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "Upload user code with USART"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1311#post-8123</link>
			<pubDate>Wed, 08 Feb 2012 06:12:29 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">8123@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;djk -&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;1. I suppose this could be good news for those of us on Windows 7 and all the issues with the DFU and comms drivers? can we flash over UART1? (i'm thinking FTDI or bluetooth).&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;Yes, absolutely. You'll need one of the upload utilities; on Windows ST provides one.&#60;br /&#62;
Google thinks it is here somewhere:&#60;br /&#62;
&#60;a href=&#34;http://www.st.com/internet/mcu/product/221020.jsp&#34; rel=&#34;nofollow&#34;&#62;http://www.st.com/internet/mcu/product/221020.jsp&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;You might consider spending the extra money to get an ST-LINK/V2:&#60;br /&#62;
&#60;a href=&#34;http://www.st.com/internet/evalboard/product/251168.jsp&#34; rel=&#34;nofollow&#34;&#62;http://www.st.com/internet/evalboard/product/251168.jsp&#60;/a&#62;&#60;br /&#62;
This has upload etc. support on Windows.&#60;br /&#62;
With suitable gdbserver software, It can also be used with gdb to give hardware debugging (breakpoints, datawatch, single step, etc)&#60;br /&#62;
It is $25 from Future&#60;br /&#62;
&#60;a href=&#34;http://www.futureelectronics.com/en/technologies/development-tools/development-tool-hardware/Pages/3008294-ST-LINK-V2.aspx?IM=0&#34; rel=&#34;nofollow&#34;&#62;http://www.futureelectronics.com/en/technologies/development-tools/development-tool-hardware/Pages/3008294-ST-LINK-V2.aspx?IM=0&#60;/a&#62;&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;2. i hope this isn't too much of a newb question....where can i find a code space memory map for the maple? i've had a tough time looking through documentation on this trying to stay out of the code.&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;Not sure what you mean. There is a Maple bootloader at the start of flash, then the user program. There are linker scripts (*.ld) which define the memory layout. For example:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;/*
 * Maple (STM32F103RBT6, medium density) linker script for Flash builds.
 */

/*
 * Define memory spaces.
 */
MEMORY
{
  ram (rwx) : ORIGIN = 0x20000C00, LENGTH = 17K
  rom (rx)  : ORIGIN = 0x08005000, LENGTH = 108K
}

/*
 * Use medium density device vector table
 */
GROUP(libcs3_stm32_med_density.a)

REGION_ALIAS(&#38;quot;REGION_TEXT&#38;quot;, rom);
REGION_ALIAS(&#38;quot;REGION_DATA&#38;quot;, ram);
REGION_ALIAS(&#38;quot;REGION_BSS&#38;quot;, ram);
REGION_ALIAS(&#38;quot;REGION_RODATA&#38;quot;, rom);

/*
 * Define the rest of the sections
 */
_FLASH_BUILD = 1;

INCLUDE common.inc&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;You can see where the Maple program is loaded in Flash (starting at 0x08005000), and what part of RAM it can use.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;3. related to the last quesiton i've tracked down the .elf files in the user data temp directories but not made much the effort to capture and get an elf file reader. Any recommendations for windows elf readers? ...&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;Not sure exactly what you mean by &#34;elf readers&#34;. I assume you want something which prints some kind of memory map of a program?&#60;/p&#62;
&#60;p&#62;Somewhere in your Maple installation, you should be able to find objdump.&#60;br /&#62;
On the Mac it is&#60;br /&#62;
MapleIDE.app/Contents/Resources/Java/hardware/tools/arm/arm-none-eabi/bin/objdump&#60;br /&#62;
and (the long &#34;arm-none-eabi...&#34; name avoids confusion in a cross compilation environment):&#60;br /&#62;
MapleIDE.app/Contents/Resources/Java/hardware/tools/arm/bin/arm-none-eabi-objdump&#60;br /&#62;
there is a manual for the &#34;Binary Utilities&#34; at:&#60;br /&#62;
&#60;a href=&#34;https://sourcery.mentor.com/sgpp/lite/arm/portal/release1802&#34; rel=&#34;nofollow&#34;&#62;https://sourcery.mentor.com/sgpp/lite/arm/portal/release1802&#60;/a&#62;&#60;br /&#62;
which explains all of the options. It will disassemble the program, and print an address map.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>djk on "Upload user code with USART"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1311#post-8117</link>
			<pubDate>Tue, 07 Feb 2012 22:13:02 +0000</pubDate>
			<dc:creator>djk</dc:creator>
			<guid isPermaLink="false">8117@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;1. I suppose this could be good news for those of us on Windows 7 and all the issues with the DFU and comms drivers? can we flash over UART1? (i'm thinking FTDI or bluetooth).&#60;/p&#62;
&#60;p&#62;2. i hope this isn't too much of a newb question....where can i find a code space memory map for the maple? i've had a tough time looking through documentation on this trying to stay out of the code. &#60;/p&#62;
&#60;p&#62;3. related to the last quesiton i've tracked down the .elf files in the user data temp directories but not made much the effort to capture and get an elf file reader. Any recommendations for windows elf readers? And any way to direct the IDE to put the elf (or some memory map file) in your sketch folder?&#60;/p&#62;
&#60;p&#62;Thanks!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Abo on "Upload user code with USART"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1311#post-8046</link>
			<pubDate>Fri, 03 Feb 2012 11:02:47 +0000</pubDate>
			<dc:creator>Abo</dc:creator>
			<guid isPermaLink="false">8046@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Thank you all, I got it to boot-load + upload my new code via USART with STMFlashLoader.&#60;/p&#62;
&#60;p&#62;Indeed the behavior of STMFlashLoader are similar to the Python script...  perhaps there is a 'erase all' command in the Python script that pevented me from uploading the two .bin? (bootload.bin + usercode.bin)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "Upload user code with USART"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1311#post-7988</link>
			<pubDate>Wed, 01 Feb 2012 20:48:21 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">7988@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;ala42 - I'm not a Windows user, but if Abo is, it might be better than the Python script.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ala42 on "Upload user code with USART"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1311#post-7987</link>
			<pubDate>Wed, 01 Feb 2012 20:10:31 +0000</pubDate>
			<dc:creator>ala42</dc:creator>
			<guid isPermaLink="false">7987@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;The package also includes the STMFlashLoader.exe command line tool.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "Upload user code with USART"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1311#post-7985</link>
			<pubDate>Wed, 01 Feb 2012 19:36:08 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">7985@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;ala42 - thank you, I've never used that tool. That will save a lot of effort.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ala42 on "Upload user code with USART"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1311#post-7983</link>
			<pubDate>Wed, 01 Feb 2012 18:58:09 +0000</pubDate>
			<dc:creator>ala42</dc:creator>
			<guid isPermaLink="false">7983@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;There is absolutely no problem when you use the STM &#34;Flash Loader Demo&#34; tool to flash the bootloader once to $8000000 and later use the STM &#34;Flash Loader Demo&#34; tool to upload your maple build program to $8005000. The only thing you have to take care of is that you do not erase the complete flash rom, you must just set the checkbox to erase only the used pages.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "Upload user code with USART"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1311#post-7979</link>
			<pubDate>Wed, 01 Feb 2012 15:38:02 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">7979@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Abo&#60;br /&#62;
&#60;blockquote&#62;So I guess my question should change from &#34;uploading user code (the .bin file)&#34; to &#34;writing self contained STM32F&#34;.&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;Yes, exactly.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;My understanding is that the normal flashing procedure with Maple IDE is&#60;br /&#62;
1. USART bootloader flashes the Maple bootloader, a self-contain program via USART (run in python)&#60;br /&#62;
2. Maple bootloader flashes the user program, not a self-contain program via USB (run with dfu-util).&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;Yes.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;The combine bootloader.bin file + user code.bin file + some work by the Maple IDE (or dfu-util), create a self-contain firmware.&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;Sort of yes. The bootloader.bin is permanently on the board, and creates the environment for the uploaded user code.bin.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;I guess the goal I need to achieve would be&#60;br /&#62;
1. USART bootloader flashes the user program, a self-contain program via USART (run in python)&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;Yes, with a broken USB that is exactly what you need. There are several other USART uploaders that run on the host PC. I think I saw a list at PyMite or an associated web site.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;From the look of the python code, it feels like I can upload a .bin file to any memory location I want.&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;Not quite. There has to be values for the reset vector, which is, by default at 0x00000000. Combinations of the BOOT pins will give three options for its location (See RM0008, section 3.4 &#34;Boot configuration&#34;). There are a few other vectors which should be initialised.  Once that is set up, yes, the program can be anywhere in valid flash or RAM.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;Would it be possible to modify the wirish.c init() function so that the compiled .bin file become a self-contained STM32 program?&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;Where is wirish.c? I thought that had been changed. Do you mean boards.cpp?&#60;/p&#62;
&#60;p&#62;I am working through the same question.&#60;br /&#62;
Essentially&#60;br /&#62;
- interrupt vectors need to be set up in the NVIC vector table,&#60;br /&#62;
- reset handler (and preferably a default handler for faults and interrupts)&#60;br /&#62;
Then execution of the reset handler runs (or calls) code for:&#60;br /&#62;
- initialised variables need to be initialised (by copying from a segment in flash)&#60;br /&#62;
- uninitialised variables need to be zero'd&#60;br /&#62;
- system and peripheral clocks, flash and NVIC&#60;br /&#62;
- static class initialisers,&#60;br /&#62;
- systick timer, and other peripherals&#60;/p&#62;
&#60;p&#62;I am 98% certain there is startup code (cs3) that comes with CodeSourcery lite that covers the first 4 steps. That source isn't included in the Maple distribution, and it might be that the license doesn't allow LeafLabs to include it.&#60;/p&#62;
&#60;p&#62;Depending on what you need to do, for example if USB is not needed, then the cs3 code might be everything.&#60;/p&#62;
&#60;p&#62;ST Micro also supply all the code needed for setup. It is a bit ugly, mostly in assembler, which is not necessary. Cortex-M3 functions can be called with nothing more than a stack pointer set, and a starting address. &#60;/p&#62;
&#60;p&#62;(full disclosure: I am not a member of LeafLabs staff.)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Abo on "Upload user code with USART"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1311#post-7972</link>
			<pubDate>Tue, 31 Jan 2012 19:23:35 +0000</pubDate>
			<dc:creator>Abo</dc:creator>
			<guid isPermaLink="false">7972@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Thanks gbulmer, while I have some C experience, I not experience in the inner work of MapleIDE and ST MCU...&#60;/p&#62;
&#60;p&#62;So I guess my question should change from &#34;uploading user code (the .bin file)&#34; to &#34;writing self contained STM32F&#34;.&#60;/p&#62;
&#60;p&#62;My understanding is that the normal flashing procedure with Maple IDE is&#60;br /&#62;
1. USART bootloader flashes the Maple bootloader, a self-contain program via USART (run in python)&#60;br /&#62;
2. Maple bootloader flashes the user program, not a self-contain program via USB (run with dfu-util). The combine bootloader.bin file + user code.bin file + some work by the Maple IDE (or dfu-util), create a self-contain firmware.&#60;/p&#62;
&#60;p&#62;I guess the goal I need to achieve would be&#60;br /&#62;
1. USART bootloader flashes the user program, a self-contain program via USART (run in python)&#60;/p&#62;
&#60;p&#62;From the look of the python code, it feels like I can upload a .bin file to any memory location I want. My problem is then writing a self-contain program without MapleIDE and dfu-util.&#60;/p&#62;
&#60;p&#62;Would it be possible to modify the wirish.c init() function so that the compiled .bin file become a self-contained STM32 program? It feels like the IDE generated main() is only missing a few calls to become self-contain. Compare the code of the bootloader main (which is a self-containted program) and the wirish.c init(), there are a lot of overlaps such as setting the clock, setupUSB, etc etc. What it missing in the wirish that pevent it from being self-contain?&#60;/p&#62;
&#60;p&#62;many thanks~
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "Upload user code with USART"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1311#post-7967</link>
			<pubDate>Tue, 31 Jan 2012 14:18:16 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">7967@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Abo - USART upload is manufactured into the chip by ST Micro. The USB bootloader is a separate and independent program uploaded by LeafLabs into Maple. They are both on chip, but do not collaborate.&#60;/p&#62;
&#60;p&#62;There is the Application note &#34;AN3155&#34; at st.com called &#34;USART protocol used in the STM32TM bootloader&#34; which explains how the USART upload works. That USART bootloader doesn't know anything about the Maple bootloader which is added by LeafLabs.&#60;/p&#62;
&#60;p&#62;The USART bootloader is really designed to load the main, and only, program into the chip. It doesn't know anything about the Maple bootloader, so it might even erase everything (I have not checked).&#60;/p&#62;
&#60;p&#62;Further, the Maple bootloader will not know anything about a program loaded by USART bootloader, so things might not be set up correctly for it to work even if the USB bootloader isn't erased.&#60;/p&#62;
&#60;p&#62;Finally, LeafLab' Maple IDE does not generate self contained STM32F program, so even if you loaded it correctly, overwriting the Maple bootloader, it would very likely not work correctly.&#60;/p&#62;
&#60;p&#62;(full disclosure: I am not a member of LeafLabs staff.)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Abo on "Upload user code with USART"</title>
			<link>http://forums.leaflabs.com/topic.php?id=1311#post-7965</link>
			<pubDate>Tue, 31 Jan 2012 13:42:48 +0000</pubDate>
			<dc:creator>Abo</dc:creator>
			<guid isPermaLink="false">7965@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I'm current trying to figure out how to upload user program (using the .bin file in the 'Temp' folder created by MapleIDE) by the USART port.&#60;/p&#62;
&#60;p&#62;I got a maple that has a damaged USB port. So I wonder if I can upload my bin by USART, just like how we can upload bootloader by USART. I look into the python code and change the address from 0x8000000 to 0x8005000 (user code starts at 0x8005000?)&#60;/p&#62;
&#60;p&#62;I first upload the boot loader to address 0x8000000 using the python script. Things works great. Then I upload my user code to address 0x8005000 and seems crush things (normally uploading via USB will first reset the chip, LED flash a few times, then go to user code - that didn't happen)&#60;/p&#62;
&#60;p&#62;I wonder if there's guide line on uploading user code (the .bin file) via USART?&#60;/p&#62;
&#60;p&#62;Many thanks
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
