<?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: How does software access &#34;firmware&#34; subroutines / programs?</title>
		<link>http://forums.leaflabs.com/topic.php?id=702</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:18: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=702" rel="self" type="application/rss+xml" />

		<item>
			<title>mbolivar on "How does software access &#34;firmware&#34; subroutines / programs?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=702&amp;page=2#post-4135</link>
			<pubDate>Mon, 04 Apr 2011 14:13:22 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">4135@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;x893,&#60;/p&#62;
&#60;p&#62;Concerning your gpio_remap code, a limited amount of the same functionality is present in the new gpio.h in the refactor branch:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;https://github.com/leaflabs/libmaple/blob/refactor/libmaple/gpio.h&#34; rel=&#34;nofollow&#34;&#62;https://github.com/leaflabs/libmaple/blob/refactor/libmaple/gpio.h&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Granted, your code is much more general.  I'll put some more remap-related convenience routines into the GPIO interface at a future date.  For now, however, I'm focusing on finishing the next release.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>x893 on "How does software access &#34;firmware&#34; subroutines / programs?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=702#post-4096</link>
			<pubDate>Wed, 30 Mar 2011 14:16:45 +0000</pubDate>
			<dc:creator>x893</dc:creator>
			<guid isPermaLink="false">4096@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Also i remove next files:&#60;br /&#62;
usb_type.h&#60;br /&#62;
usb_hardware.c&#60;br /&#62;
usb_hardware.h&#60;br /&#62;
also modify print.cpp so not use scanf()
&#60;/p&#62;</description>
		</item>
		<item>
			<title>StephenFromNYC on "How does software access &#34;firmware&#34; subroutines / programs?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=702#post-4090</link>
			<pubDate>Wed, 30 Mar 2011 08:00:09 +0000</pubDate>
			<dc:creator>StephenFromNYC</dc:creator>
			<guid isPermaLink="false">4090@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hello-&#60;/p&#62;
&#60;p&#62;gbulmer, thanks again for all the help and encouragement.  I may revive &#60;a href=&#34;http://forums.leaflabs.com/topic.php?id=692&#34;&#62;the USB specific discussion&#60;/a&#62; after I do some more reading.&#60;/p&#62;
&#60;p&#62;I have not looked for RM0008 errata on the st.com web site.  Where are these error reports stored (or found) and how are their titles described?&#60;/p&#62;
&#60;p&#62;Yes, I have the &#60;code&#62;UM0424&#60;/code&#62; user manual (a PDF) for the full speed development kit (a zip).  Posting the complete URL for &#60;code&#62;UM0424&#60;/code&#62; will be useful to some users.&#60;/p&#62;
&#60;p&#62;The development kit manual and the peripheral demonstration software (designed to be run on the st.com evaluation boards) are also listed on the (non flash and faster loading?) st.com &#60;a href=&#34;http://forums.leaflabs.com/topic.php?id=703&#34;&#62;link I provided earlier&#60;/a&#62; for the three st.com pages which describe the three different STM32F103 microcontrollers used on the Maple, Maple Mini, and Maple Native boards.&#60;/p&#62;
&#60;p&#62;During the next few weeks I may try to implement the st.com USB demonstration programs (released to work with their evaluation board).  I am curious to see if I can make any headway on the isochronous USB transfers.&#60;/p&#62;
&#60;p&#62;Yes, from an earlier 2010 post I remember a warning about processor clock speed and STM32 features, such as &#60;a href=&#34;http://forums.leaflabs.com/topic.php?id=162&#34;&#62;ADC sampling rates&#60;/a&#62;.  My next big block of time working with the Maple will wait until I see the new DMA stuff which comes out with the next IDE.&#60;/p&#62;
&#60;p&#62;Thanks!&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://forums.leaflabs.com/profile.php?id=843&#34;&#62;Stephen from NYC&#60;/a&#62; (full disclosure: I am not a member of the LeafLabs staff)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "How does software access &#34;firmware&#34; subroutines / programs?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=702#post-4083</link>
			<pubDate>Tue, 29 Mar 2011 10:46:13 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">4083@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;StephenFromNYC - I think this covers all the remaining questions, if not, keep going :-)&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;How do the bits interact with the underlying electronics? Do examples of &#34;underlying electronics&#34; include the USB circuits? My assumption is yes.&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;Yes USB is part of the underlying electronics.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;After the required physical memory locations are set to the required values in a peripheral device how is a circuit activated/triggered?&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;It depends in which peripheral and which register values are being set.&#60;/p&#62;
&#60;p&#62;Remember the whole STM32F is clocked at a few speeds, the main processor and some peripherals at 72MHz, and some of the other peripherals are at 36MHz. Some peripherals divide down the clock to get their working clock. This is described in RM0008. Many of the peripherals need to be enabled, which effectively switches them on, and connects them to an appropriate clock signal.&#60;/p&#62;
&#60;p&#62;The memory locations 'built into' peripherals are running synchronously. Many of the peripherals will trigger behaviour on the next clock signal. Some will allow values to be set, but will not act until specifically enabled (I vaguely remember some of the timer features work this way). Again RM0008 (and errata) describes the precise details.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;In order to create cleaner core code for the USB functions how do programmers know the specific memory locations to place variables (the &#34;where&#34;) and how to trigger the specified behavior (I thought about using the word &#34;function&#34; here, but that seems to suggest source code, which I know is *not* present) in a peripheral?&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;As mbolivar said RM0008 describes the peripherals and their registers.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;A simpler way to ask the same question is where is the st.com documentation (besides the code demos) which describes how to access/change/trigger/read the desired behaviors? Or does one simply need to read and fully understand what the st.com demo source code achieves before leaner libmaple quality code can be written?&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;there are a couple of USB documents at ST.com at &#60;a href=&#34;http://www.st.com/stonline/stappl/resourceSelector/app?page=resourceSelector&#38;amp;doctype=USER_MANUAL&#38;amp;SubClassID=1169&#34;&#62;User Manuals&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;For example &#60;a href=&#34;http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/USER_MANUAL/CD00158241.pdf&#34; rel=&#34;nofollow&#34;&#62;http://www.st.com/internet/com/TECHNICAL_RESOURCES/TECHNICAL_LITERATURE/USER_MANUAL/CD00158241.pdf&#60;/a&#62;&#60;br /&#62;
which is called UM0424 User manual: STM32F10xxx USB-FS-Device development kit&#60;/p&#62;
&#60;p&#62;It gives an overview for each of the USB devices demo'd in the source at &#60;a href=&#34;http://www.st.com/stonline/stappl/resourceSelector/app?page=resourceSelector&#38;amp;doctype=FIRMWARE&#38;amp;SubClassID=1169&#34; rel=&#34;nofollow&#34;&#62;http://www.st.com/stonline/stappl/resourceSelector/app?page=resourceSelector&#38;amp;doctype=FIRMWARE&#38;amp;SubClassID=1169&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>x893 on "How does software access &#34;firmware&#34; subroutines / programs?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=702#post-4080</link>
			<pubDate>Mon, 28 Mar 2011 23:15:40 +0000</pubDate>
			<dc:creator>x893</dc:creator>
			<guid isPermaLink="false">4080@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;For example&#60;/p&#62;
&#60;p&#62;gpio_remap.h&#60;/p&#62;
&#60;p&#62;#ifndef _GPIO_REMAP_H&#60;br /&#62;
#define _GPIO_REMAP_H&#60;/p&#62;
&#60;p&#62;#ifdef __cplusplus&#60;br /&#62;
 extern &#34;C&#34; {&#60;br /&#62;
#endif&#60;/p&#62;
&#60;p&#62;#define AFIO_MAPR2		((volatile uint32*)0x4001001C)&#60;br /&#62;
#define DBGMCU_IDCODE		((volatile uint32*)0xE0042000)&#60;br /&#62;
#define DBGMCU_CR		((volatile uint32*)0xE0042004)&#60;/p&#62;
&#60;p&#62;#define GPIO_Remap_SPI1             ((uint32)0x00000001)  /*!&#38;lt; SPI1 Alternate Function mapping */&#60;br /&#62;
#define GPIO_Remap_I2C1             ((uint32)0x00000002)  /*!&#38;lt; I2C1 Alternate Function mapping */&#60;br /&#62;
#define GPIO_Remap_USART1           ((uint32)0x00000004)  /*!&#38;lt; USART1 Alternate Function mapping */&#60;br /&#62;
#define GPIO_Remap_USART2           ((uint32)0x00000008)  /*!&#38;lt; USART2 Alternate Function mapping */&#60;br /&#62;
#define GPIO_PartialRemap_USART3    ((uint32)0x00140010)  /*!&#38;lt; USART3 Partial Alternate Function mapping */&#60;br /&#62;
#define GPIO_FullRemap_USART3       ((uint32)0x00140030)  /*!&#38;lt; USART3 Full Alternate Function mapping */&#60;br /&#62;
#define GPIO_PartialRemap_TIM1      ((uint32)0x00160040)  /*!&#38;lt; TIM1 Partial Alternate Function mapping */&#60;br /&#62;
#define GPIO_FullRemap_TIM1         ((uint32)0x001600C0)  /*!&#38;lt; TIM1 Full Alternate Function mapping */&#60;br /&#62;
#define GPIO_PartialRemap1_TIM2     ((uint32)0x00180100)  /*!&#38;lt; TIM2 Partial1 Alternate Function mapping */&#60;br /&#62;
#define GPIO_PartialRemap2_TIM2     ((uint32)0x00180200)  /*!&#38;lt; TIM2 Partial2 Alternate Function mapping */&#60;br /&#62;
#define GPIO_FullRemap_TIM2         ((uint32)0x00180300)  /*!&#38;lt; TIM2 Full Alternate Function mapping */&#60;br /&#62;
#define GPIO_PartialRemap_TIM3      ((uint32)0x001A0800)  /*!&#38;lt; TIM3 Partial Alternate Function mapping */&#60;br /&#62;
#define GPIO_FullRemap_TIM3         ((uint32)0x001A0C00)  /*!&#38;lt; TIM3 Full Alternate Function mapping */&#60;br /&#62;
#define GPIO_Remap_TIM4             ((uint32)0x00001000)  /*!&#38;lt; TIM4 Alternate Function mapping */&#60;br /&#62;
#define GPIO_Remap1_CAN1            ((uint32)0x001D4000)  /*!&#38;lt; CAN1 Alternate Function mapping */&#60;br /&#62;
#define GPIO_Remap2_CAN1            ((uint32)0x001D6000)  /*!&#38;lt; CAN1 Alternate Function mapping */&#60;br /&#62;
#define GPIO_Remap_PD01             ((uint32)0x00008000)  /*!&#38;lt; PD01 Alternate Function mapping */&#60;br /&#62;
#define GPIO_Remap_TIM5CH4_LSI      ((uint32)0x00200001)  /*!&#38;lt; LSI connected to TIM5 Channel4 input capture for calibration */&#60;br /&#62;
#define GPIO_Remap_ADC1_ETRGINJ     ((uint32)0x00200002)  /*!&#38;lt; ADC1 External Trigger Injected Conversion remapping */&#60;br /&#62;
#define GPIO_Remap_ADC1_ETRGREG     ((uint32)0x00200004)  /*!&#38;lt; ADC1 External Trigger Regular Conversion remapping */&#60;br /&#62;
#define GPIO_Remap_ADC2_ETRGINJ     ((uint32)0x00200008)  /*!&#38;lt; ADC2 External Trigger Injected Conversion remapping */&#60;br /&#62;
#define GPIO_Remap_ADC2_ETRGREG     ((uint32)0x00200010)  /*!&#38;lt; ADC2 External Trigger Regular Conversion remapping */&#60;br /&#62;
#define GPIO_Remap_ETH              ((uint32)0x00200020)  /*!&#38;lt; Ethernet remapping (only for Connectivity line devices) */&#60;br /&#62;
#define GPIO_Remap_CAN2             ((uint32)0x00200040)  /*!&#38;lt; CAN2 remapping (only for Connectivity line devices) */&#60;br /&#62;
#define GPIO_Remap_SWJ_NoJTRST      ((uint32)0x00300100)  /*!&#38;lt; Full SWJ Enabled (JTAG-DP + SW-DP) but without JTRST */&#60;br /&#62;
#define GPIO_Remap_SWJ_JTAGDisable  ((uint32)0x00300200)  /*!&#38;lt; JTAG-DP Disabled and SW-DP Enabled */&#60;br /&#62;
#define GPIO_Remap_SWJ_Disable      ((uint32)0x00300400)  /*!&#38;lt; Full SWJ Disabled (JTAG-DP + SW-DP) */&#60;br /&#62;
#define GPIO_Remap_SPI3             ((uint32)0x00201000)  /*!&#38;lt; SPI3/I2S3 Alternate Function mapping (only for Connectivity line devices) */&#60;br /&#62;
#define GPIO_Remap_TIM2ITR1_PTP_SOF ((uint32)0x00202000)  /*!&#38;lt; Ethernet PTP output or USB OTG SOF (Start of Frame) connected&#60;br /&#62;
                                                                 to TIM2 Internal Trigger 1 for calibration&#60;br /&#62;
                                                                 (only for Connectivity line devices) */&#60;br /&#62;
#define GPIO_Remap_PTP_PPS          ((uint32)0x00204000)  /*!&#38;lt; Ethernet MAC PPS_PTS output on PB05 (only for Connectivity line devices) */&#60;/p&#62;
&#60;p&#62;#define GPIO_Remap_TIM15            ((uint32)0x80000001)  /*!&#38;lt; TIM15 Alternate Function mapping (only for Value line devices) */&#60;br /&#62;
#define GPIO_Remap_TIM16            ((uint32)0x80000002)  /*!&#38;lt; TIM16 Alternate Function mapping (only for Value line devices) */&#60;br /&#62;
#define GPIO_Remap_TIM17            ((uint32)0x80000004)  /*!&#38;lt; TIM17 Alternate Function mapping (only for Value line devices) */&#60;br /&#62;
#define GPIO_Remap_CEC              ((uint32)0x80000008)  /*!&#38;lt; CEC Alternate Function mapping (only for Value line devices) */&#60;br /&#62;
#define GPIO_Remap_TIM1_DMA         ((uint32)0x80000010)  /*!&#38;lt; TIM1 DMA requests mapping (only for Value line devices) */&#60;/p&#62;
&#60;p&#62;#define GPIO_Remap_TIM9             ((uint32)0x80000020)  /*!&#38;lt; TIM9 Alternate Function mapping (only for XL-density devices) */&#60;br /&#62;
#define GPIO_Remap_TIM10            ((uint32)0x80000040)  /*!&#38;lt; TIM10 Alternate Function mapping (only for XL-density devices) */&#60;br /&#62;
#define GPIO_Remap_TIM11            ((uint32)0x80000080)  /*!&#38;lt; TIM11 Alternate Function mapping (only for XL-density devices) */&#60;br /&#62;
#define GPIO_Remap_TIM13            ((uint32)0x80000100)  /*!&#38;lt; TIM13 Alternate Function mapping (only for XL-density devices) */&#60;br /&#62;
#define GPIO_Remap_TIM14            ((uint32)0x80000200)  /*!&#38;lt; TIM14 Alternate Function mapping (only for XL-density devices) */&#60;br /&#62;
#define GPIO_Remap_FSMC_NADV        ((uint32)0x80000400)  /*!&#38;lt; FSMC_NADV Alternate Function mapping (only for XL-density devices) */&#60;/p&#62;
&#60;p&#62;void gpio_remap(uint32 GPIO_Remap, uint8 NewState);&#60;br /&#62;
uint32 DBGMCU_GetREVID(void);&#60;br /&#62;
uint32 DBGMCU_GetDEVID(void);&#60;/p&#62;
&#60;p&#62;#ifdef __cplusplus&#60;br /&#62;
} // extern &#34;C&#34;&#60;br /&#62;
#endif&#60;/p&#62;
&#60;p&#62;#endif&#60;/p&#62;
&#60;p&#62;and gpio_remap.c&#60;/p&#62;
&#60;p&#62;#include &#34;libmaple.h&#34;&#60;br /&#62;
#include &#34;gpio.h&#34;&#60;br /&#62;
#include &#34;gpio_remap.h&#34;&#60;br /&#62;
#include &#34;util.h&#34;&#60;/p&#62;
&#60;p&#62;#define LSB_MASK                    ((uint16)0xFFFF)&#60;br /&#62;
#define DBGAFR_POSITION_MASK        ((uint32)0x000F0000)&#60;br /&#62;
#define DBGAFR_LOCATION_MASK        ((uint32)0x00200000)&#60;br /&#62;
#define DBGAFR_NUMBITS_MASK         ((uint32)0x00100000)&#60;br /&#62;
#define DBGAFR_SWJCFG_MASK          ((uint32)0xF0FFFFFF)&#60;/p&#62;
&#60;p&#62;#define IDCODE_DEVID_Mask    ((uint32)0x00000FFF)&#60;/p&#62;
&#60;p&#62;void gpio_remap(uint32 GPIO_Remap, uint8 NewState)&#60;br /&#62;
{&#60;br /&#62;
	uint32 tmp = 0x00, tmp1 = 0x00, tmpmask = 0x00, tmpreg;&#60;/p&#62;
&#60;p&#62;	if((GPIO_Remap &#38;amp; 0x80000000) == 0x80000000)&#60;br /&#62;
		tmpreg = *(AFIO_MAPR2);&#60;br /&#62;
	else&#60;br /&#62;
		tmpreg = *(AFIO_MAPR);&#60;/p&#62;
&#60;p&#62;	tmpmask = (GPIO_Remap &#38;amp; DBGAFR_POSITION_MASK) &#38;gt;&#38;gt; 0x10;&#60;br /&#62;
	tmp = GPIO_Remap &#38;amp; LSB_MASK;&#60;/p&#62;
&#60;p&#62;	if ((GPIO_Remap &#38;amp; (DBGAFR_LOCATION_MASK &#124; DBGAFR_NUMBITS_MASK)) == (DBGAFR_LOCATION_MASK &#124; DBGAFR_NUMBITS_MASK))&#60;br /&#62;
	{&#60;br /&#62;
		tmpreg &#38;amp;= DBGAFR_SWJCFG_MASK;&#60;br /&#62;
		*(AFIO_MAPR) &#38;amp;= DBGAFR_SWJCFG_MASK;&#60;br /&#62;
	}&#60;br /&#62;
	else if ((GPIO_Remap &#38;amp; DBGAFR_NUMBITS_MASK) == DBGAFR_NUMBITS_MASK)&#60;br /&#62;
	{&#60;br /&#62;
		tmp1 = ((uint32)0x03) &#38;lt;&#38;lt; tmpmask;&#60;br /&#62;
		tmpreg &#38;amp;= ~tmp1;&#60;br /&#62;
		tmpreg &#124;= ~DBGAFR_SWJCFG_MASK;&#60;br /&#62;
	}&#60;br /&#62;
	else&#60;br /&#62;
	{&#60;br /&#62;
		tmpreg &#38;amp;= ~(tmp &#38;lt;&#38;lt; ((GPIO_Remap &#38;gt;&#38;gt; 0x15)*0x10));&#60;br /&#62;
		tmpreg &#124;= ~DBGAFR_SWJCFG_MASK;&#60;br /&#62;
	}&#60;/p&#62;
&#60;p&#62;	if (NewState != 0)&#60;br /&#62;
		tmpreg &#124;= (tmp &#38;lt;&#38;lt; ((GPIO_Remap &#38;gt;&#38;gt; 0x15)*0x10));&#60;/p&#62;
&#60;p&#62;	if((GPIO_Remap &#38;amp; 0x80000000) == 0x80000000)&#60;br /&#62;
		*(AFIO_MAPR2) = tmpreg;&#60;br /&#62;
	else&#60;br /&#62;
		*(AFIO_MAPR) = tmpreg;&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;/*&#60;br /&#62;
	This field indicates the revision of the device:&#60;br /&#62;
		In low-density devices:&#60;br /&#62;
			– 0x1000 = Revision A&#60;br /&#62;
		In medium-density devices:&#60;br /&#62;
			– 0x0000 = Revision A&#60;br /&#62;
			– 0x2000 = Revision B&#60;br /&#62;
			– 0x2001 = Revision Z&#60;br /&#62;
			– 0x2003 = Revision Y&#60;br /&#62;
		In high-density devices:&#60;br /&#62;
			– 0x1000 = Revision A&#60;br /&#62;
			– 0x1001 = Revision Z&#60;br /&#62;
			– 0x1003 = Revision Y&#60;br /&#62;
		In XL-density devices:&#60;br /&#62;
			– 0x1000 = Revision A&#60;br /&#62;
		In connectivity line devices:&#60;br /&#62;
			– 0x1000 = Revision A&#60;br /&#62;
			– 0x1001 = Revision Z&#60;br /&#62;
*/&#60;br /&#62;
uint32 DBGMCU_GetREVID(void)&#60;br /&#62;
{&#60;br /&#62;
	return (*((volatile uint32*)0x8000000));&#60;br /&#62;
	// return((*(DBGMCU_IDCODE)) &#38;gt;&#38;gt; 16);&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;/*&#60;br /&#62;
		This field indicates the device ID.&#60;br /&#62;
		0x412	low-density devices&#60;br /&#62;
		0x410	medium-density devices&#60;br /&#62;
		0x414	high-density devices&#60;br /&#62;
		0x430	XL-density devices&#60;br /&#62;
		0x418	connectivity devices&#60;br /&#62;
*/&#60;br /&#62;
uint32 DBGMCU_GetDEVID(void)&#60;br /&#62;
{&#60;br /&#62;
   return(*DBGMCU_IDCODE &#38;amp; IDCODE_DEVID_Mask);&#60;br /&#62;
}
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mbolivar on "How does software access &#34;firmware&#34; subroutines / programs?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=702#post-4077</link>
			<pubDate>Mon, 28 Mar 2011 16:17:32 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">4077@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;x893,&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;
Books and theoretical knowledge very perfect but what happend if i set crystal with 4 Mhz except 8Mhz. How many changes i need make for UART work at 57600. After 2 days porting Maple for STM32F105 the situation is very sad. ST library make more occuracy but more complex.
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;You are correct.  The current state of the libmaple master tree makes all sorts of assumptions about how you're using the microcontroller that are not appropriate for all situations.  We are trying to make the low-level libmaple APIs make as few assumptions as possible about the particular chip you are using.&#60;/p&#62;
&#60;p&#62;For example, here is a function in my personal libmaple clone that makes doing what you want with the USART much easier:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;/**
 *  @brief Enable a USART in single buffer transmission mode, multibuffer
 *     receiver mode.
 *  @param dev USART to be initialized
 *  @param clock_speed Clock rate, in cycles per microsecond
 *  @param baud Baud rate to set
 */
void usart_init(usart_dev *dev, uint32 clock_speed, uint32 baud) {
    rcc_clk_enable(dev-&#38;gt;clk_id);
    nvic_irq_enable(dev-&#38;gt;irq_num);

    /* Initialize rx ring buffer  */
    rb_init(dev-&#38;gt;rb, USART_RX_BUF_SIZE, dev-&#38;gt;rx_buf);

    /* Set baud rate */
    usart_set_baud_rate(dev, clock_speed, baud);

    /* Enable the USART and set mode to 8n1 */
    dev-&#38;gt;regs-&#38;gt;CR1 = (USART_CR1_TE          &#124;    // transmitter enable
                      USART_CR1_RE          &#124;    // receiver enable
                      USART_CR1_RXNEIE);          // receive interrupt enable
    dev-&#38;gt;regs-&#38;gt;CR1 &#124;= USART_CR1_UE;
}&#60;/code&#62;&#60;/pre&#62;
&#60;blockquote&#62;&#60;p&#62;
In my local copy of maple ~ 30% additional functions which not presents in maple (and i not see any plans about implement it).
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;We'd love to see your patches.  Are they available online somewhere?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>x893 on "How does software access &#34;firmware&#34; subroutines / programs?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=702#post-4073</link>
			<pubDate>Mon, 28 Mar 2011 11:11:09 +0000</pubDate>
			<dc:creator>x893</dc:creator>
			<guid isPermaLink="false">4073@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Books and theoretical knowledge very perfect but what happend if i set crystal with 4 Mhz except 8Mhz. How many changes i need make for UART work at 57600. After 2 days porting Maple for STM32F105 the situation is very sad. ST library make more occuracy but more complex.&#60;br /&#62;
In my local copy of maple ~ 30% additional functions which not presents in maple (and i not see any plans about implement it).&#60;/p&#62;
&#60;p&#62;I understand that 99% of maple professional customers never need this functions but beginners like me sometime need link timers or use CAN.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>StephenFromNYC on "How does software access &#34;firmware&#34; subroutines / programs?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=702#post-4071</link>
			<pubDate>Mon, 28 Mar 2011 10:29:52 +0000</pubDate>
			<dc:creator>StephenFromNYC</dc:creator>
			<guid isPermaLink="false">4071@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hello-&#60;/p&#62;
&#60;p&#62;Thanks to mbolivar for the link to the MIT open courseware and for an early view to the &#60;code&#62;libmaple design&#60;/code&#62; tutorial.  I like the approach of starting with a simple description of how &#60;code&#62;libmaple&#60;/code&#62; accesses the ADC functions.  Now I have a better understanding of registers and how they are used on the Maple.&#60;/p&#62;
&#60;p&#62;Last fall I downloaded the &#60;a href=&#34;http://forums.leaflabs.com/topic.php?id=703&#34;&#62;RM0008 reference manual&#60;/a&#62; (version 11), but I forgot about it because it was too early to appreciate its content.  Version 12 is the most recent version of this document.  It answers many of my questions.&#60;/p&#62;
&#60;p&#62;I hope gbulmer's earlier answers to my questions can be applied by other users focusing on features of microcontrollers other than USB!  Thanks for the references/resources.&#60;/p&#62;
&#60;p&#62;I was not able to reply to gbulmer's insightful explanations during the weekend, but here are some more reflections on his comments.&#60;/p&#62;
&#60;p&#62;gbulmer said:&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;
The electronics of a USB peripheral, to the level of this discussion, implements the low-level behaviour directly. The circuits are organised irrevocably to implement a fixed set of functions. There is no code inside the USB peripheral that we can get at.&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;Yes, this makes perfect sense to me.  I did a bad job of describing what I was imaging/speculating.  The circuits inside any peripheral (eg. USB) implement a specific behavior which cannot be changed because the logic gates in the silicon cannot be changed. [Side question: are FPGAs, which will be used in the Maple Native, similar to reprogrammable RAM which does not lose the memory contents?]&#60;/p&#62;
&#60;p&#62;Source &#34;code&#34; does not exist in any tangible way in a peripheral, but I am guessing that if all the logic gates of an extremely simple integrated circuit are described it is possible to create a flow diagram which matches what the silicon circuits accomplish.  Once you have a flow diagram you understand how the circuit works.  In a peripheral the only circuits present (hopefully) are those needed to accomplish a specific job.&#60;/p&#62;
&#60;p&#62;gbulmer continues with:&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;
The hardware is mapped into fixed memory locations (like variables at specific addresses), and specific bits within those memory locations interact with the underlying electronics.&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;Yes, I can easily imagine setting specific predefined physical memory locations (including memory locations in peripherals) to be equal to specific varibles.  Is this similar to the old &#34;poke&#34; functions?  After &#34;activation&#34; and some flipping of the logic gates the results can be read via a &#34;peek&#34; type function.  I appreciate how the result (eg. a variable of type char) can be broken down into its individual bits (eg. a char has eight bits; each which can have a different meaning).&#60;/p&#62;
&#60;p&#62;gbulmer continues with:&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;
memory locations are part of peripherals, and are visible to the program.&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;The above quote makes sense.&#60;/p&#62;
&#60;p&#62;I appreciate that function names used in &#60;code&#62;libmaple&#60;/code&#62; do not have to be copied from the st.com code.  It is the st.com code behavior which has to be emulated in &#60;code&#62;libmaple&#60;/code&#62;, not the function names.&#60;/p&#62;
&#60;p&#62;I appreciate that the st.com demo code (distributed for use on their evaluation boards) and the LeafLabs code are both on the same footing (neither is at a lower or higher level).  All code occupies the FLASH/SRAM in the microcontroller.  Do BIOS type programs exist in microcontroller?  My guess is no.&#60;/p&#62;
&#60;p&#62;Let me try to explain what I meant when I wrote:&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;
When microprocessors are programmed are any variable names reserved?
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;If a reserved software variable name were equivalent to a physical memory location (which we have established can exist in a peripheral) it would be a way for programs to set memory spaces to specific values.&#60;/p&#62;
&#60;p&#62;Now things get fuzzy for me really quickly.&#60;/p&#62;
&#60;p&#62;How do the bits interact with the underlying electronics?  Do examples of &#34;underlying electronics&#34; include the USB circuits?  My assumption is yes.&#60;/p&#62;
&#60;p&#62;After the required physical memory locations are set to the required values in a peripheral device how is a circuit activated/triggered?&#60;/p&#62;
&#60;p&#62;In order to create cleaner core code for the USB functions how do programmers know the specific memory locations to place variables (the &#34;where&#34;) and how to trigger the specified behavior (I thought about using the word &#34;function&#34; here, but that seems to suggest source code, which I know is *not* present) in a peripheral?&#60;/p&#62;
&#60;p&#62;A simpler way to ask the same question is where is the st.com documentation (besides the code demos) which describes how to access/change/trigger/read the desired behaviors?  Or does one simply need to read and fully understand what the st.com demo source code achieves before leaner &#60;code&#62;libmaple&#60;/code&#62; quality code can be written?&#60;/p&#62;
&#60;p&#62;Thanks!&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://forums.leaflabs.com/profile.php?id=843&#34;&#62;Stephen from NYC&#60;/a&#62; (full disclosure: I am not a member of the LeafLabs staff)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "How does software access &#34;firmware&#34; subroutines / programs?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=702#post-4061</link>
			<pubDate>Sun, 27 Mar 2011 08:28:16 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">4061@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;mbolivar - thanks for the ocw.mit link&#60;/p&#62;
&#60;p&#62;I did this sort of stuff 30+ years ago when I did my CS degree (though I thought the Osborne book was better) when we did 'computer architecture'. We hand-assembled programs, and programmed the hardware in hex, which I think was a bit harsh, but we understood the bare-metal basics.&#60;/p&#62;
&#60;p&#62;I've read some of the Hennessy and Patterson books.&#60;br /&#62;
So now some more 'grist for the mill' :-)&#60;/p&#62;
&#60;p&#62;I am looking forward to Oak. I hope easier FPGA programming will re-kindle people's interest in hardware-software interfaces, and givem them a practical way to experiment.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mbolivar on "How does software access &#34;firmware&#34; subroutines / programs?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=702#post-4053</link>
			<pubDate>Sat, 26 Mar 2011 18:02:48 +0000</pubDate>
			<dc:creator>mbolivar</dc:creator>
			<guid isPermaLink="false">4053@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Fantastic discussion so far!  This definitely seems like the makings of a tutorial on how to read the low-level libmaple code.&#60;/p&#62;
&#60;p&#62;To gbulmer's excellent responses, I would add only this:&#60;/p&#62;
&#60;p&#62;StephenFromNYC:&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;
What is a register, and how are registers related to these questions? How are registers access (read or changed) by software?
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;If you read ST document RM0008 (&#60;a href=&#34;http://www.st.com/stonline/products/literature/rm/13902.pdf&#34; rel=&#34;nofollow&#34;&#62;http://www.st.com/stonline/products/literature/rm/13902.pdf&#60;/a&#62; ; it's the central reference manual for the entire Cortex M3 line of ST microcontrollers), you'll notice that the entire discussion for a given peripheral (like an ADC converter or the USB device) is explained in terms of &#34;registers&#34;, and bits inside of those registers.&#60;/p&#62;
&#60;p&#62;Registers in this sense are the &#34;specific memory locations&#34; gbulmer was referencing in this paragraph:&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;
The program uses specific memory locations to put or get specific values, the electronics is 'directly connected' to specific locations and are triggered by values in those locations, and (the electronics) sets one or more bits within memory values to give back data.
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;I'm currently in the process of writing up a design document for libmaple (specifically, for the refactor branch that we keep talking about).  An early draft is available here; it contains some more discussion on what registers are and how we interact with them in our source code:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://static.leaflabs.com/mbolivar/libmaple_design/&#34; rel=&#34;nofollow&#34;&#62;http://static.leaflabs.com/mbolivar/libmaple_design/&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Finally, as a parting shot, MIT has course materials for the class 6.004 available online:&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-004-computation-structures-spring-2009/&#34; rel=&#34;nofollow&#34;&#62;http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-004-computation-structures-spring-2009/&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;That's the class where undergraduates are taught the basics of how computers are organized at the hardware level.  I found it to be extremely well taught and very illuminating, so if you decide you're interested in the low level details, I'd recommend looking at the link above.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "How does software access &#34;firmware&#34; subroutines / programs?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=702#post-4046</link>
			<pubDate>Sat, 26 Mar 2011 05:25:24 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">4046@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;StephenFromNYC&#60;br /&#62;
&#60;blockquote&#62;I will respond to gbulmer's above post when I have time early next week.&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;If I was off the mark, save yourself time, and ignore it.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "How does software access &#34;firmware&#34; subroutines / programs?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=702#post-4043</link>
			<pubDate>Fri, 25 Mar 2011 16:55:03 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">4043@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;StephenFromNYC&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;Is there any way to write a sketch which uses the LeafLabs IDE, but with the st.com header (*.h) and source (*.c) files (in particular for full speed USB functions), which can be uploaded to a Maple board, and which runs as expected?&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;Almost definitely. There is no deep 'magic'. &#60;/p&#62;
&#60;p&#62;I've done this sort of thing with the Arduino IDE, and the same strategy will work.&#60;/p&#62;
&#60;p&#62;Create a tab in the IDE, copy and past one of the ST code files into it , save it with the same (or similar) name as the original (let's say usb.c)&#60;br /&#62;
You will likely get errors because some of the header files are in the wrong place, e.g. usb.c may contain&#60;br /&#62;
&#60;code&#62;#include &#38;lt;usb.h&#38;gt;&#60;/code&#62;&#60;br /&#62;
but in the worst case, you can fix that by putting the headers into a folder structure, and using the full path name, by code like&#60;br /&#62;
&#60;code&#62;#include &#38;lt;C:/users/stephen/documents/st/include/usb.h&#38;gt;&#60;/code&#62;&#60;br /&#62;
into usb.c&#60;/p&#62;
&#60;p&#62;You will get messages that functions are missing. If you have grep, you will quickly be able to find the file which contains the missing function (if you have the source). Create tabs for each file of ST code that you need.&#60;br /&#62;
Keep going until the compiler and linker is happy.&#60;/p&#62;
&#60;p&#62;You will have to change the name of the main() function in the ST code. Call it something clever like mymain(), and call it from setup(). (I'd put the code for blink in loop() :-)&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;If I could get the interrupt/bulk/isochronous USB sample programs to run I might be able to find some time to make progress on implementing the interrupt and isochronous type USB transfers.&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;I assume (some part) of the ST code implements everything you need. (Build one or more entire USB device which supports the transfer &#38;amp; endpoint types you want)&#60;/p&#62;
&#60;p&#62;Edit: Without writing a host-side USB driver, the obstacle to using the transfer and endpoint types, in the way you want, is the host-side USB driver.&#60;br /&#62;
There is a limited set of device types supported, and the combination of transfer types (and endpoints), *and* the way they are used might not exist.&#60;/p&#62;
&#60;p&#62;You may get some problems:&#60;br /&#62;
1. The amount of code you end up having to deal with is too huge, and it is unmanageable. Response: No big help here other than try to find the smallest example possible to get to grips with the code.&#60;br /&#62;
2. The compiler used for the code assumes there are specific libraries which are not available in source code.&#60;br /&#62;
Response: Nasty. Ask for help if this happens.&#60;br /&#62;
3. The ST code forces itself to be loaded at a specific address, which kills the Maple bootloader.&#60;br /&#62;
Response: Unpleasant but unlikely to be insoluble.&#60;br /&#62;
4. Other problems ... :-)&#60;br /&#62;
Response: ask for help, it may be hard work in places, but I would expect that nothing is insoluble except the ST code (which you combine to do what you want) needs much more Flash or RAM than is on the Maple, (or more endpoints than the USB hardware supports. Once the 8 USB endpoints, which is quite a lot, are allocated, there is no way to create more on the STM32F)&#60;/p&#62;
&#60;p&#62;Edit: tried to clarify my words, some changes are in &#34;(...)&#34;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>StephenFromNYC on "How does software access &#34;firmware&#34; subroutines / programs?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=702#post-4042</link>
			<pubDate>Fri, 25 Mar 2011 16:48:14 +0000</pubDate>
			<dc:creator>StephenFromNYC</dc:creator>
			<guid isPermaLink="false">4042@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hello-&#60;/p&#62;
&#60;p&#62;I was hoping to get this post in before gbulmer replied, but I was too slow.  I will respond to &#60;a href=&#34;http://forums.leaflabs.com/topic.php?id=702#post-4041&#34;&#62;gbulmer's above post&#60;/a&#62; when I have time early next week.&#60;/p&#62;
&#60;p&#62;Here is another, more applied, way to express what I am trying to learn.&#60;/p&#62;
&#60;p&#62;Is there any way to write a sketch which uses the LeafLabs IDE, but with the st.com demo header (*.h) and source (*.c) files (in particular for full speed USB functions), which can be uploaded to a Maple board, and which runs as expected?&#60;/p&#62;
&#60;p&#62;If I could get the interrupt/bulk/isochronous USB sample programs to run I might be able to find some time to make progress on implementing the interrupt and isochronous type USB transfers.&#60;/p&#62;
&#60;p&#62;I appreciate why the LeafLabs teams wants to be independent of the st.com software.  Ideally, I do not want to start with a completely blank system.&#60;/p&#62;
&#60;p&#62;It may be easier for me (or anyone else) to start with a working st.com base system and then slowly replace the st.com code with code which is easier to upgrade.&#60;/p&#62;
&#60;p&#62;Does this make sense?&#60;/p&#62;
&#60;p&#62;Thanks!&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://forums.leaflabs.com/profile.php?id=843&#34;&#62;Stephen from NYC&#60;/a&#62; (full disclosure: I am not a member of the LeafLabs staff)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "How does software access &#34;firmware&#34; subroutines / programs?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=702#post-4041</link>
			<pubDate>Fri, 25 Mar 2011 16:41:10 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">4041@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;StephenfromNYC - cracking qustions!&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;In microcontrollers such as the the STM32F103X chips used in the Maple there are simple circuits (AND, OR, XOR, etc gates) created using silicon.&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;Yes.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;When combined the circuits create subroutines and programs which are related to specific functions (eg. USB). How am I doing so far?&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;No. The electronics of a USB peripheral, to the level of this discussion, implements the low-level behaviour directly. The circuits are organised irrevocably to implement a fixed set of functions. There is no code 'inside' the USB peripheral that we can get at.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;My most basic question is how does software such as the st.com demo software and libmaple which is located in FLASH/SRAM access these hardware circuits?&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;The hardware is mapped into fixed memory locations (like variables at specific addresses), and specific bits within those memory locations interact with the underlying electronics.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;How does a program which exists in FLASH/SRAM access a program ... which exists somewhere else on the silicon wafer?&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;There is only one area of programs, which is the program that is held in Flash/RAM. &#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;At the lowest level (which I do *not* think I am interested in learning) I am assuming accessing these circuits requires knowing which values to put in which memory spaces and when to activate the appropriate circuits.&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;Close, and maybe this is just a typo away.&#60;br /&#62;
The program uses specific memory locations to put or get specific values, the electronics is 'directly connected' to specific locations and are triggered by values in those locations, and (the electronics) sets one or more bits within memory values to give back data.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;How are circuits &#34;activated&#34;?&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;There is a bit of detail in the STM32F because the programmer (e.g. you) can switch power on and off for peripheral electronics, but let's skip this.&#60;br /&#62;
Fundamentally, memory locations are part of each peripherals electrionics, and are visible to the program.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;In becoming independent of ST code at what level does libmaple need to replicate what the ST code achieves?&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;Yes. (If the same functionality is required,) the entire set (of ST code) needs to be implemented in code that runs from Flash/RAM.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;To make the software/silicon connection does libmaple just need to replicate just the functionality of the ST code? In other words, for the core USB functions, is libmaple limited (or required) to using functions which match the ST code function in name only (while being given the freedom to change the body of each function). Or is libmaple free to use any function names it wants as long as the correct values are placed in the correct memory spaces (ie the functionality of the ST code)?&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;The ST code is on exactly the same footing as LeafLabs code. The LeafLabs code can use any names it likes because the names within the code will have no significance to the USB hardware.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;For example, in usb.h (found in libmaple) the following function is defined: usbReceiveBytes(uint8* recvBuf, uint32 len);&#60;/p&#62;
&#60;p&#62;Is there a function also called usbReceiveBytes in the st.com code which has the same functionality, but different code in the function body?&#60;/p&#62;
&#60;/blockquote&#62;
&#60;p&#62;It is irrelevant (what the functions are called), because the names don't matter if the code is not combined into a single program and linked (which is not what you are describing).&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;
When microprocessors are programmed are any variable names reserved?
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;In C programming there are names which are reserved for specific predefined purposes (e.g. main), but I am not sure that is what you mean.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;I am assume there is a way for a low level function for a program to say &#34;I am about to make several changes to different memory locations, so do not do anything until I am finished.&#34;
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;Yes, the only way that program flow can be diverted is by an interrupt (or exception) usually caused by a peripheral (such as a timer, or an external pin, USB, etc). There are instructions which a program can execute to control the hardware and switch off interrupts, i.e. stop the hardware diverting program flow when something happens in a peripheral.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;What is a register, and how are registers related to these questions? How are registers access (read or changed) by software?
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;In some ways, registers are exactly the same as memory (RAM) locations. They just have very compact addresses to make encoding programs much more compact (On the STM32F, memory addresses as 32 bits, 4 bytes long, so if the instruction to add two numbers, and put the answer into a third location could only operate on memory locations, the instruction would have to contain three 4 byte locations, plus some more bits to encode the unique identity of the add instruction).&#60;br /&#62;
They are also available for processing in much less time than RAM, so the processor can take two register values, add them, and put the answer into a third register in less time that it takes to get one value from RAM.  Registers are sometimes called the processors 'scratchpad', the program uses the registers to work things out, then writes them back to memory when the program moves on to a different task.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;
Do you recommend any specific links or resources?
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;My favourite books were:&#60;br /&#62;
Structure and Interpretation of Computer Programs&#60;br /&#62;
&#60;a href=&#34;http://mitpress.mit.edu/sicp/full-text/book/book.html&#34; rel=&#34;nofollow&#34;&#62;http://mitpress.mit.edu/sicp/full-text/book/book.html&#60;/a&#62;&#60;br /&#62;
but that is quite big, and abstract for the questions I think you are asking (though I may have misunderstood) (I can't see my copy, I think I loaned it to a friend (note to self), but it is about 600 pages)&#60;/p&#62;
&#60;p&#62;My other favourite is no longer in print, but you might find a copy:&#60;br /&#62;
&#60;a href=&#34;http://www.amazon.com/Introduction-Microcomputers-v-1/dp/0931988349&#34; rel=&#34;nofollow&#34;&#62;http://www.amazon.com/Introduction-Microcomputers-v-1/dp/0931988349&#60;/a&#62;&#60;br /&#62;
&#60;a href=&#34;http://www.amazon.com/Introduction-Microcomputers-Basic-Concepts-v/dp/0079310346&#34; rel=&#34;nofollow&#34;&#62;http://www.amazon.com/Introduction-Microcomputers-Basic-Concepts-v/dp/0079310346&#60;/a&#62;&#60;br /&#62;
This is the book that got me &#34;into&#34; computing. But still quite a deep dive.&#60;br /&#62;
It did deal in (specific and concrete) detail with how a processor worked, how it interacted with peripherals, etc.&#60;br /&#62;
Let me think some more. I am sure someone can think of something a bit better.&#60;br /&#62;
Maybe it isn't as fashionable to write books which deal with this sort of stuff as in the late 70's and early 80's.&#60;/p&#62;
&#60;p&#62;Edit: tried to clarify my words, mostly additions are in &#34;(...)&#34;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>StephenFromNYC on "How does software access &#34;firmware&#34; subroutines / programs?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=702#post-4040</link>
			<pubDate>Fri, 25 Mar 2011 16:36:36 +0000</pubDate>
			<dc:creator>StephenFromNYC</dc:creator>
			<guid isPermaLink="false">4040@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hello-&#60;/p&#62;
&#60;p&#62;Here is another, more applied, way to express what I am trying to learn.&#60;/p&#62;
&#60;p&#62;Is there any way to write a sketch which uses the LeafLabs IDE, but with the st.com header (*.h) and source (*.c) files (in particular for full speed USB functions), which can be uploaded to a Maple board, and which runs as expected?&#60;/p&#62;
&#60;p&#62;If I could get the interrupt/bulk/isochronous USB sample programs to run I might be able to find some time to make progress on implementing the interrupt and isochronous type USB transfers.&#60;/p&#62;
&#60;p&#62;I appreciate why the LeafLabs teams wants to be independent of the st.com software.&#60;/p&#62;
&#60;p&#62;Ideally, I do not want to start with a completely blank system.&#60;/p&#62;
&#60;p&#62;It would be easier for me (or anyone else) to start with a working st.com base system and then slowly replace the st.com code with code which is easier to upgrade.&#60;/p&#62;
&#60;p&#62;Thanks!&#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;http://forums.leaflabs.com/profile.php?id=843&#34;&#62;Stephen from NYC&#60;/a&#62; (full disclosure: I am not a member of the LeafLabs staff)
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
