<?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: Inofficial libmaple F3-port</title>
		<link>http://forums.leaflabs.com/topic.php?id=11883</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:04:56 +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=11883" rel="self" type="application/rss+xml" />

		<item>
			<title>gbulmer on "Inofficial libmaple F3-port"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11883#post-105496</link>
			<pubDate>Sun, 24 Aug 2014 05:34:26 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">105496@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;@ala42 and @ventosus- Thank you for posting that.&#60;/p&#62;
&#60;p&#62;Separating a MB1136 C-02 nucleo into two pieces isn't as easy and benign as it might appear!&#60;/p&#62;
&#60;p&#62;I assume, for parts with on-chip USB, that separation would cause them to fall outside the USB timing spec if the user programs to use the internal oscillator. The STM32F042 and STM32F072 subfamilies has an internal precision oscillator to provide 'crystal-less' USB, but the vast majority of STM32 do not.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ventosus on "Inofficial libmaple F3-port"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11883#post-105495</link>
			<pubDate>Fri, 22 Aug 2014 03:01:14 +0000</pubDate>
			<dc:creator>ventosus</dc:creator>
			<guid isPermaLink="false">105495@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;@ala42 thanks, I have seen that in the meantime, too. I have never used a Discovery, so could't know...&#60;/p&#62;
&#60;p&#62;Apparently the Nucleo boards are shipped in at least two versions, one configured with no external crystal (MB1136 C-01: the one I got), the other prewired to the ST-Link clock (MB1136 C-02).
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ala42 on "Inofficial libmaple F3-port"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11883#post-105494</link>
			<pubDate>Tue, 19 Aug 2014 17:29:46 +0000</pubDate>
			<dc:creator>ala42</dc:creator>
			<guid isPermaLink="false">105494@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;5.7 OSC clock&#60;br /&#62;
5.7.1 OSC clock supply&#60;br /&#62;
There are four ways to configure the pins corresponding to external high-speed clock external high-speed clock (HSE):&#60;br /&#62;
• MCO from ST-LINK: MCO output of ST-LINK MCU is used as input clock. This&#60;br /&#62;
frequency cannot be changed, it is fixed at 8 MHz and connected to PF0/PD0/PH0-&#60;br /&#62;
OSC_IN of STM32 microcontroller.&#60;br /&#62;
The following configuration is needed:&#60;br /&#62;
– SB54, SB55 OFF&#60;br /&#62;
– R35,R37 removed&#60;br /&#62;
– SB16, SB50 ON&#60;/p&#62;
&#60;p&#62;In case you forgot, the Discovery F3 also has no oscillator in the F3 part of the board, you also use the 8Mhz clock from the ST-Link part.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ventosus on "Inofficial libmaple F3-port"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11883#post-105493</link>
			<pubDate>Tue, 19 Aug 2014 02:31:21 +0000</pubDate>
			<dc:creator>ventosus</dc:creator>
			<guid isPermaLink="false">105493@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;&#38;gt;&#38;gt; Well done for debugging the lack of crystal. That must have been hard to spot.&#60;/p&#62;
&#60;p&#62;Not at all. When I saw that my blinky sketch did not blink, I just fired up the ST-LINK/V2-1 via OpenOCD+GDB and looked where the sketch was hanging and immediately saw that it was stuck in an indefinite loop trying to bring up the external crystal. After a shy look at the board I saw that there was none...&#60;/p&#62;
&#60;p&#62;OpenOCD does not yet ship with a board config file for the nucleo F302R8, this did the trick for me though (OpenOCD 0.8.0):&#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#60;br /&#62;
st_nucleo_f302r8.cfg&#60;br /&#62;
--------------------&#60;br /&#62;
source [find interface/stlink-v2-1.cfg]&#60;br /&#62;
source [find target/stm32f3x_stlink.cfg]&#60;br /&#62;
reset_config srst_only srst_nogate&#60;br /&#62;
gdb_memory_map disable&#60;br /&#62;
&#60;/code&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "Inofficial libmaple F3-port"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11883#post-105492</link>
			<pubDate>Mon, 18 Aug 2014 05:11:15 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">105492@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;@ventosus - Thank you for sharing this. &#60;/p&#62;
&#60;p&#62;Your timing is excellent. I was looking at Farnell over the weekend, and they have the STM32F302 nicleo in stock, so I was wondering about getting some to experiment with.&#60;/p&#62;
&#60;p&#62;Well done for debugging the lack of crystal. That must have been hard to spot.&#60;br /&#62;
Cheers!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ventosus on "Inofficial libmaple F3-port"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11883#post-105491</link>
			<pubDate>Mon, 18 Aug 2014 02:40:57 +0000</pubDate>
			<dc:creator>ventosus</dc:creator>
			<guid isPermaLink="false">105491@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I have updated the F3-port to support more chips.&#60;/p&#62;
&#60;p&#62;Theoretically all the currently available STM32F301/302/303 chips should be supported:&#60;/p&#62;
&#60;p&#62;STM32F301xx:&#60;/p&#62;
&#60;p&#62;-STM32F301K6&#60;br /&#62;
-STM32F301K8&#60;br /&#62;
-STM32F301C6&#60;br /&#62;
-STM32F301C8&#60;br /&#62;
-STM32F301R6&#60;br /&#62;
-STM32F301R8&#60;/p&#62;
&#60;p&#62;STM32F302xx:&#60;/p&#62;
&#60;p&#62;-STM32F302K6&#60;br /&#62;
-STM32F302K8&#60;br /&#62;
-STM32F302C6&#60;br /&#62;
-STM32F302C8&#60;br /&#62;
-STM32F302CB&#60;br /&#62;
-STM32F302CC&#60;br /&#62;
-STM32F302R6&#60;br /&#62;
-STM32F302R8&#60;br /&#62;
-STM32F302RB&#60;br /&#62;
-STM32F302RC&#60;br /&#62;
-STM32F302VB&#60;br /&#62;
-STM32F302VC&#60;/p&#62;
&#60;p&#62;STM32F303xx:&#60;/p&#62;
&#60;p&#62;-STM32F303K6&#60;br /&#62;
-STM32F303K8&#60;br /&#62;
-STM32F303C6&#60;br /&#62;
-STM32F303C8&#60;br /&#62;
-STM32F303CB&#60;br /&#62;
-STM32F303CC&#60;br /&#62;
-STM32F303R6&#60;br /&#62;
-STM32F303R8&#60;br /&#62;
-STM32F303RB&#60;br /&#62;
-STM32F303RC&#60;br /&#62;
-STM32F303VB&#60;br /&#62;
-STM32F303VC&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;https://github.com/ventosus/libmaple/tree/F3&#34; rel=&#34;nofollow&#34;&#62;https://github.com/ventosus/libmaple/tree/F3&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Apart from the STM32F303CB and STM32F303CC that I have thoroughly tested so far, I have a ST NUCLEO-F302R8 since some days.&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1847/PF259999&#34; rel=&#34;nofollow&#34;&#62;http://www.st.com/web/catalog/tools/FM116/SC959/SS1532/LN1847/PF259999&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;To use the nucleo with the F3-port, just compile for&#60;br /&#62;
[code]&#60;br /&#62;
BOARD=F302R8&#60;br /&#62;
MEMORY_TARGET=jtag&#60;br /&#62;
[/code]&#60;br /&#62;
mount the nucleo as USB mass storage, copy the bin/F302R8.bin to the mass storage, unmount it and the sketch should be running. The included ST/Link works out of the box with OpenOCD and GDB.&#60;/p&#62;
&#60;p&#62;My nucleo was shipped without an oscillator, as libmaple by default assumes that there is an external oscillator and will block until it's up and running, the following patch needs to be applied, though:&#60;/p&#62;
&#60;p&#62;[code]&#60;br /&#62;
diff --git a/wirish/boards.cpp b/wirish/boards.cpp&#60;br /&#62;
index a693fa6..e97259d 100644&#60;br /&#62;
--- a/wirish/boards.cpp&#60;br /&#62;
+++ b/wirish/boards.cpp&#60;br /&#62;
@@ -122,8 +122,8 @@ static void setup_clocks(void) {&#60;br /&#62;
     RCC_BASE-&#38;gt;CIR = 0x00000000;&#60;/p&#62;
&#60;p&#62;     // Enable HSE, and wait until it's ready.&#60;br /&#62;
-    rcc_turn_on_clk(RCC_CLK_HSE);&#60;br /&#62;
-    while (!rcc_is_clk_ready(RCC_CLK_HSE))&#60;br /&#62;
+    rcc_turn_on_clk(RCC_CLK_HSI);&#60;br /&#62;
+    while (!rcc_is_clk_ready(RCC_CLK_HSI))&#60;br /&#62;
         ;&#60;/p&#62;
&#60;p&#62;     // Configure AHBx, APBx, etc. prescalers and the main PLL.&#60;br /&#62;
diff --git a/wirish/stm32f3/boards_setup.cpp b/wirish/stm32f3/boards_setup.cpp&#60;br /&#62;
index 6984419..b1a4991 100644&#60;br /&#62;
--- a/wirish/stm32f3/boards_setup.cpp&#60;br /&#62;
+++ b/wirish/stm32f3/boards_setup.cpp&#60;br /&#62;
@@ -59,7 +59,7 @@ namespace wirish {&#60;br /&#62;
     namespace priv {&#60;/p&#62;
&#60;p&#62;         static stm32f3_rcc_pll_data pll_data = {.pll_mul=BOARD_RCC_PLLMUL, .pcl&#60;br /&#62;
-        __weak rcc_pll_cfg w_board_pll_cfg = {RCC_PLLSRC_HSE, &#38;amp;pll_data};&#60;br /&#62;
+        __weak rcc_pll_cfg w_board_pll_cfg = {RCC_PLLSRC_HSI_DIV_2, &#38;amp;pll_data};&#60;br /&#62;
         __weak adc_prescaler w_adc_pre = ADC_PRE_PCLK_DIV_1;&#60;br /&#62;
         __weak adc_smp_rate w_adc_smp = ADC_SMPR_181_5;&#60;/p&#62;
&#60;p&#62;[/code]
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "Inofficial libmaple F3-port"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11883#post-104963</link>
			<pubDate>Fri, 22 Nov 2013 11:24:32 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">104963@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;ventosus - Thank you for the links.&#60;/p&#62;
&#60;p&#62;&#60;em&#62;My changes are based on ST's annotationAN4296:&#60;br /&#62;
&#60;a href=&#34;http://www.st.com/st-web-ui/static/active/en/resource/technical/document/application_note/DM00083249.pdf&#34; rel=&#34;nofollow&#34;&#62;http://www.st.com/st-web-ui/static/active/en/resource/technical/document/application_note/DM00083249.pdf&#60;/a&#62;&#60;/em&#62;&#60;br /&#62;
I had missed that, so thank you very much.&#60;/p&#62;
&#60;p&#62;&#60;em&#62;&#34;Have you done any experiments to measure the effect?&#34;&#60;br /&#62;
No real benchmarking, but I've put interrupts and critical routines into CCM in one of my projects for testing and got an immediate speed-up in the range of 10% to 20%.&#60;/em&#62;&#60;/p&#62;
&#60;p&#62;10%-20% is pretty impressive for a chip which is already pretty quick .&#60;/p&#62;
&#60;p&#62;&#60;em&#62;&#34;Is there a slow-down if both code and data reside in core coupled memory (CCM)?&#34;&#60;br /&#62;
This I don't know. Would you expect this?&#60;/em&#62;&#60;br /&#62;
Well, I have looked through the STM32F303 datasheet, and all it says about the CCM is&#60;br /&#62;
&#34;2.3 Embedded SRAM&#60;br /&#62;
The STM32F30xx features up to 48 Kbytes of static SRAM. It can be accessed as bytes, halfwords (16 bits) or full words (32 bits):&#60;br /&#62;
●	...&#60;br /&#62;
●	8 Kbytes of CCM RAM. ... This memory can be addressed at maximum system clock frequency without wait state.&#34;&#60;/p&#62;
&#60;p&#62;So it looks fine. However there isn't anything more concrete.&#60;br /&#62;
Also, I vaguely remember there being a buffer between the CPU and SRAM, which 'pipelined' the 2nd and subsequent write, but was complex enough that it might slow the first write, or interact with reads. I haven't found this mentioned any where for Cortex-M4 so I may be thinking Cortex-M3.&#60;/p&#62;
&#60;p&#62;Summary: I am happy to believe it does everything perfectly, no matter what mix of instructions and data are used, but I am also willing to believe that there are interactions between reading instructions and writing data.&#60;/p&#62;
&#60;p&#62;However, 10-20% is enough to convince me it's worth it anyway :-)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ventosus on "Inofficial libmaple F3-port"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11883#post-104962</link>
			<pubDate>Fri, 22 Nov 2013 08:28:27 +0000</pubDate>
			<dc:creator>ventosus</dc:creator>
			<guid isPermaLink="false">104962@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;My changes are basen on ST's annotationAN4296:&#60;br /&#62;
&#60;a href=&#34;http://www.st.com/st-web-ui/static/active/en/resource/technical/document/application_note/DM00083249.pdf&#34; rel=&#34;nofollow&#34;&#62;http://www.st.com/st-web-ui/static/active/en/resource/technical/document/application_note/DM00083249.pdf&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;linker script with its section definitions is at:&#60;br /&#62;
support/ld/common.inc&#60;/p&#62;
&#60;p&#62;initialization code, where code from FLASH is copied to CCM is at:&#60;br /&#62;
wirish/start_c.c&#60;/p&#62;
&#60;p&#62;Here is the git commit with the changes:&#60;br /&#62;
&#60;a href=&#34;https://github.com/ventosus/libmaple/commit/3a745ec937647f48bc94a58b938ab26f882e752c&#34; rel=&#34;nofollow&#34;&#62;https://github.com/ventosus/libmaple/commit/3a745ec937647f48bc94a58b938ab26f882e752c&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;&#60;em&#62;Have you done any experiments to measure the effect?&#60;/em&#62;&#60;br /&#62;
No real benchmarking, but I've put interrupts and critical routines into CCM in one of my projects for testing and got an immediate speed-up in the range of 10% to 20%.&#60;/p&#62;
&#60;p&#62;&#60;em&#62;Is there a slow-down if both code and data reside in core coupled memory (CCM)?&#60;/em&#62;&#60;br /&#62;
This I don't know. Would you expect this?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "Inofficial libmaple F3-port"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11883#post-104961</link>
			<pubDate>Fri, 22 Nov 2013 06:36:38 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">104961@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;ventosus - That's very interesting! &#60;/p&#62;
&#60;p&#62;It might be helpful if you would post a link to the ld (load) script?&#60;/p&#62;
&#60;p&#62;Have you done any experiments to measure the effect?&#60;br /&#62;
Is there a slow-down if both code and data reside in core coupled memory (CCM)?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ventosus on "Inofficial libmaple F3-port"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11883#post-104957</link>
			<pubDate>Thu, 21 Nov 2013 14:26:05 +0000</pubDate>
			<dc:creator>ventosus</dc:creator>
			<guid isPermaLink="false">104957@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I've worked some of my poor ld-script-fu to make the 8kB core coupled memory (CCM) usable. One can now put code in there which will be run at maximum speed (zero wait state compared to 2 wait states when loading code from FLASH). It can also be used as extended SRAM of course.&#60;/p&#62;
&#60;p&#62;The right place to put interrupts and other critical code to get a considerable performance increase...&#60;/p&#62;
&#60;p&#62;There is a convenience macro __CCM__ which sets the corresponding section attributes.&#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#60;br /&#62;
  #define __CCM__ __attribute__((section(&#34;.CCM&#34;)))&#60;br /&#62;
&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;Just append it to your data or function prototypes to be put into core coupled memory.&#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#60;br /&#62;
  int mydata __CCM__ = 23;&#60;br /&#62;
&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#60;br /&#62;
  void myfunc(void) __CCM__;&#60;br /&#62;
  void myfunc(void) {&#60;br /&#62;
    ...&#60;br /&#62;
  }&#60;br /&#62;
&#60;/code&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "Inofficial libmaple F3-port"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11883#post-31743</link>
			<pubDate>Mon, 23 Sep 2013 14:28:10 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">31743@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;mlundinse - You're right. I allowed my enthusiasm to overcome good sense. Thinking about it, I'm not sure the R Pi gcc toolchain will generate barebones arm-none-eabi program files either. &#60;/p&#62;
&#60;p&#62;I am slightly less worried about the startup and libraries than I am calling conventions (ABI), linker scripts, static linking, ...&#60;/p&#62;
&#60;p&#62;I vaguely remember reading through an enormous number of options in the documentation for gcc for generating ARM code, and almost anything looking 'possible'. I also very vaguely (more than 5 years) remember a mechanism where the name used to execute the compiler was used by the compiler itself to figure out what it was supposed to do.&#60;/p&#62;
&#60;p&#62;However, I am willing to believe that configuring the right set of options is less likely than winning the National Lottery. I am also willing to believe that it can't be done by any normal gcc for ARM and Linux.&#60;/p&#62;
&#60;p&#62;Thanks for keeping my feet on the ground :-)&#60;/p&#62;
&#60;p&#62;(PS - I am getting into Golang, and maybe Beagle Bone Black, so I'm unlikely to try)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mlundinse on "Inofficial libmaple F3-port"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11883#post-30956</link>
			<pubDate>Thu, 19 Sep 2013 15:57:49 +0000</pubDate>
			<dc:creator>mlundinse</dc:creator>
			<guid isPermaLink="false">30956@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;gbulmer - I am not sure that the R Pi gcc toolchain will generate barebones arm-none-eabi program files that is needed by the maple. It is configured to generate code to run under a Linux OS. The same assembler instructions but the default startup and library stuff are different. I have no idea how hard, or easy, it is to convince this toolchain to generate ode for barebones arm.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Adam on "Inofficial libmaple F3-port"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11883#post-30955</link>
			<pubDate>Thu, 19 Sep 2013 15:57:11 +0000</pubDate>
			<dc:creator>Adam</dc:creator>
			<guid isPermaLink="false">30955@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;ventosus,&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;
&#60;em&#62;Error during download get_status&#60;/em&#62;&#60;br /&#62;
Up-stream reports that this has been fixed already some months ago in dfu-util git.
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;And so it is. I got the latest source and tried out it - no error message.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ventosus on "Inofficial libmaple F3-port"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11883#post-30824</link>
			<pubDate>Thu, 19 Sep 2013 01:33:55 +0000</pubDate>
			<dc:creator>ventosus</dc:creator>
			<guid isPermaLink="false">30824@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;&#60;em&#62;Error during download get_status&#60;/em&#62;&#60;/p&#62;
&#60;p&#62;Up-stream reports that this has been fixed already some months ago in dfu-util git.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>Adam on "Inofficial libmaple F3-port"</title>
			<link>http://forums.leaflabs.com/topic.php?id=11883#post-30740</link>
			<pubDate>Wed, 18 Sep 2013 13:18:33 +0000</pubDate>
			<dc:creator>Adam</dc:creator>
			<guid isPermaLink="false">30740@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;ventosus,&#60;/p&#62;
&#60;p&#62;Thank you! I rebuilt using the orone_mini_F3 target and it works!&#60;/p&#62;
&#60;p&#62;gbulmer,&#60;/p&#62;
&#60;p&#62;Thank you for the Orone-mini - great board design!&#60;/p&#62;
&#60;p&#62;I'm going to try some performance tests today and tomorrow. I'll report back.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
