I’m trying to get started with some code development for the STM32F103C8T6 Minimum System Development board I bought on eBay:
http://www.ebay.com/itm/STM32F103C8T6-A … SwosFUVEEU
Anyhow, it seems I have been chasing my own tail on this for the past several days trying to get even a minimalist IDE set up and running. My goal is to be “somewhat” seamless between between development on my Raspberry Pi (which I use Python, and a few other softwares to do some basic I2C programming for the GY-86 IMU board) and my Win10 laptop. I seem to be running into all sorts of problems, and as a result I have downloaded and evaluated several IDEs over the past few days just trying to get started.
I know of issues regarding the Arduino IDE in regards to its board manager. Ideally the Arduino IDE would be my first choice for an IDE because of its compatibility with the Raspberry Pi (As a side note, I have tried several Linux compatible IDEs, but ran into incompatibility issues with libraries and tools refusing to install because of “older” versions of the IDE, eg Eclipse 3.8.1 for Raspberry Pi).
Yes, I realize I could get the old Notepad out, and cross compile with gcc with ARM tools, but I just as soon have one IDE between my Win10 laptop and Raspberry Pi like the Arduino IDE.
Although I have compiled code for the STM32F103 on Arduino 1.6.5 on Windows, I get the following message on the Raspberry Pi:
“arduino stm32 avr-g++: error unrecognized argument in option ‘-mmcu=null'” along with a long list of suggested avr-type mcu’s to use.
I also get this same error message if I attempt to upgrade the Arduino IDE to the latest version on Windows. To add to my frustration, Boards Manager seems to be missing on the Linux version of the Arduino IDE, and therefore I can’t seem to apply Roger Clark’s fix for by adding the SAM boards.
Any and all help would be greatly appreciated. I guess my basic problem is getting the Arduino IDE set up properly for both Win10 and Raspberry Pi. I would appreciate any help on where to install libraries, and how to tweak the IDE so that it works.
Also, I have downloaded some of Jeff Rowberg’s Arduino examples for MPU6050. But the odd thing is, if I run a basic program like ASCIITable, the usb port will work on the dev board (using Windows Arduino IDE 1.6.5), but if I try to use Jeff’s code, the usb port functionality goes away (I lose COM8) and I can’t use the Arduino Serial Monitor to watch the outputs. I have looked through the code as much as I can, and see what seems to be the same references for setting up the serial port in both programs, however, only ASCIITables works, and the MPU6050 doesn’t. If anyone could shed some light on this as to why this is, I would be very thankful.
Cheers
~/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/I am using Arduino.cc’s 1.6.7 for AVR 8-bit and ESP8266 and Sparkfun’s 32U4 Pro Micro and I use Arduino.org’s 1.7.8 for STM32duino (I use Maple Mini exclusively.) I have 1.0.5 ArduinoIDE also installed for some old attiny85 cores.
The only issue I had with Linux was some file permissions that needed adjusting – otherwise all 3 IDE’s coexist and play nice.
We have had a number of posts about Win-10, http://www.stm32duino.com/viewtopic.php?t=920, but I think generally folks have managed to get it running.
Ray
I forget which thread the link was posted in, but if you do a google search of the site you should find it.
BTW.
It does work with Windows 10, but you may have to install the drivers via the Bat file and then manually install again via the device manger, if Windows finds the device but then says it doesnt have a driver. ( this may be because the board is either a DFU device or a USB Serial device ( but not both at the same time) and W10 may now only be installing device drivers for devices it thinks are connected.
The problem with W10, is that it auto updates all the time and there is no way to stop this.
So MS can change the way the drivers are installed at any time, and we would not be aware that an update has stopped the drivers installing for new users ![]()
Personally, I dont run W10 because of the auto update problem, and for other compatibility reasons, not associated with the Arduino IDE
On my Windows 10 environment, everything seems to be going good for the most part. I am using 1.6.5, and the Arduino_STM32-master file. My STLINK V2 from Adafruit is recognized, as is (when it is properly working) the Maple Serial port (on COM8).
On the Raspberry Pi side of things, I’m still having one or two issues I cant seem to resolve. I am running a RPi 2 with full Raspbian Jesse. The Arduino IDE is version 2.1.0.5+dfsg2-4. Using the Arduino_STM32-master file, I am able to see the Examples, Library examples. One of the problems is that the Raspbian version of Arduino IDE will not scroll the Boards menu properly, so when you do add the boards, you have no way of seeing the extra STM32 boards. The menu is longer than the screen, and won’t scroll. The other issue is that when I compile the Blink example, I still get this error from avr-g++
“arduino stm32 avr-g++: error unrecognized argument in option ‘-mmcu=null'” along with a long list of suggested avr-type mcu’s to use.
It seems like the Arduino IDE doesn’t know how to compile for the STM32F103C8T6 board I have, and errors on what seems to be a choice required for the proper board.
Is there a fix for this?
I should also mention that I ran the install.sh script in the Arduino_STM32-master file and put user “Pi” in the dialout group. Thanks in advance for the help.
Cheers
First, the arduino-1.6.8/lib/libastylej.so and arduino-1.6.8/lib/liblistSerialsj.so need to be updated to ARM version.
The first can be install/copied from an “apt-get” while the second needs to be recompiled from scratch with sources from github.
Then, lunching the IDE, I could navigate into the Board Manager and select SAM, it started installing it …
Unfortunately, after 2 hours, install progress bar still shows 50% …
EDIT : install still ongoing … looking at linux “free”, the swapmem is in use … So, RasberryPi is out of resources !
I will leave it finished even if it take days, just to figure out.
Successful bare-metal programming an STM32F103C8T6 with a Raspberry Pi 2 , GCC, arm-none-eabi toolchain, and Openocd running a clone ST-Link V2 from Adafruit. Bitscope BS05 is used to monitor the output. All that just to blink an LED lol =]

Board is a STM32F103C8T6 Minimum System Development Board from eBay:
http://www.ebay.com/itm/STM32F103C8T6-A … SwosFUVEEU
URL where source files were obtained:
http://siwawi.bauing.uni-kl.de/avr_proj … tm32_blink
I had to modify the code to run GPIO Port C, Pin 13 as an Open Drain:
/
******************** (C) COPYRIGHT 2007 STMicroelectronics ********************
* File Name : main.c
* Author : MCD Application Team
* Version : V1.0
* Date : 10/08/2007
* Description : Main program body
********************************************************************************
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*******************************************************************************/
/* Includes ------------------------------------------------------------------*/
#include "stm32f10x_lib.h"
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
GPIO_InitTypeDef GPIO_InitStructure;
ErrorStatus HSEStartUpStatus;
/* Private function prototypes -----------------------------------------------*/
void RCC_Configuration(void);
void NVIC_Configuration(void);
void Delay(vu32 nCount);
/* Private functions ---------------------------------------------------------*/
/*******************************************************************************
* Function Name : main
* Description : Main program.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
int main(void)
{
#ifdef DEBUG
debug();
#endif
/* Configure the system clocks */
RCC_Configuration();
/* NVIC Configuration */
NVIC_Configuration();
/* Enable GPIOC clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);
/* Configure PC.13 as Output Open Drain Output */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_10MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_OD;
GPIO_Init(GPIOC, &GPIO_InitStructure);
while (1)
{
/* Turn on led connected to PC.13 pin */
GPIO_SetBits(GPIOC, GPIO_Pin_13);
/* Insert delay */
Delay(0xAFFFF);
/* Turn off led connected to PC.13 pin */
GPIO_ResetBits(GPIOC, GPIO_Pin_13);
/* Insert delay */
Delay(0xAFFFF);
}
}
/*******************************************************************************
* Function Name : RCC_Configuration
* Description : Configures the different system clocks.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void RCC_Configuration(void)
{
/* RCC system reset(for debug purpose) */
RCC_DeInit();
/* Enable HSE */
RCC_HSEConfig(RCC_HSE_ON);
/* Wait till HSE is ready */
HSEStartUpStatus = RCC_WaitForHSEStartUp();
if(HSEStartUpStatus == SUCCESS)
{
/* Enable Prefetch Buffer */
FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
/* Flash 2 wait state */
FLASH_SetLatency(FLASH_Latency_2);
/* HCLK = SYSCLK */
RCC_HCLKConfig(RCC_SYSCLK_Div1);
/* PCLK2 = HCLK */
RCC_PCLK2Config(RCC_HCLK_Div1);
/* PCLK1 = HCLK/2 */
RCC_PCLK1Config(RCC_HCLK_Div2);
/* PLLCLK = 8MHz * 9 = 72 MHz */
RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);
/* Enable PLL */
RCC_PLLCmd(ENABLE);
/* Wait till PLL is ready */
while(RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)
{
}
/* Select PLL as system clock source */
RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
/* Wait till PLL is used as system clock source */
while(RCC_GetSYSCLKSource() != 0x08)
{
}
}
}
/*******************************************************************************
* Function Name : NVIC_Configuration
* Description : Configures Vector Table base location.
* Input : None
* Output : None
* Return : None
*******************************************************************************/
void NVIC_Configuration(void)
{
#ifdef VECT_TAB_RAM
/* Set the Vector Table base location at 0x20000000 */
NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0);
#else /* VECT_TAB_FLASH */
/* Set the Vector Table base location at 0x08000000 */
NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);
#endif
}
/*******************************************************************************
* Function Name : Delay
* Description : Inserts a delay time.
* Input : nCount: specifies the delay time length.
* Output : None
* Return : None
*******************************************************************************/
void Delay(vu32 nCount)
{
for(; nCount != 0; nCount--);
}
#ifdef DEBUG
/*******************************************************************************
* Function Name : assert_failed
* Description : Reports the name of the source file and the source line number
* where the assert_param error has occurred.
* Input : - file: pointer to the source file name
* - line: assert_param error line source number
* Output : None
* Return : None
*******************************************************************************/
void assert_failed(u8* file, u32 line)
{
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
/* Infinite loop */
while (1)
{
}
}
#endif
/******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
1.6.5 is the supported version
I think, @ddrown has done a Boards Manager package with changes to work for 1.6.7, but I’ve not tried it
Re: Why does the Arduino make things look simple
This is the main purpose of the Arduino system… That and the standardised libraries for SPI I2C and the many other contributed libraries
<…>
Successful bare-metal programming an STM32F103C8T6 with a Raspberry Pi 2 , GCC, arm-none-eabi toolchain, and Openocd running a clone ST-Link V2 from Adafruit. Bitscope BS05 is used to monitor the output. All that just to blink an LED lol =] <…>
QUESTIONS:
Why does Arduino IDE make this look so innocently simple? I suspect there is a lot more going on in the background than what the Arduino IDE shows. GCC is very “busy and noisy” in comparison.
Is there a list of “key words” (mnemonics?) that I can find to use with the GCC compiler? The Arduino IDE keeps things very simple, and I would love to port some of Roger Clark’s STM32 Master File example code over to the GCC side of things… How do I do this?
Thanks for all the help and suggestions. I have truly learned a lot from this thread =]
Cheers!!!
Did you try the Arduino.org’s version of the IDE… I am using 1.7.7 on Linux Mint 16.3 64-bit with no issues. There is no board manager in this branch to screw with you.
<…>
I think that has been the main problem all along. Yeah, Raspberry Pi is a 32-bit platform, but it is ARM based
<…>
Only the *.so are required to be rebuild for ARM, especially liblistSerialJ.so.
BTW, With old RaspberryPi which had only 512K, the taking almost all the memory, it is painfully slow since it start swapping.
stevech wrote:What’s the goal/motivation to do compiles/builds on an RPi.
Well, for me, it would be too much time for something not useful! Maybe the ROI is learning new stuff: if so, it’d be much easier to use a fast Linux computer.
Did you try the Arduino.org’s version of the IDE…
Once I tested one of them, ArduinoDroid, using the blink sketch. It is slow but it works, even if you have a clone with a CH340.
Maybe the new Odroid C2 is better than a RPi3 for this purpouse.
There is NO needs to recompile the Java JAR.
Doctor: Well, don’t do that!



