[SOLVED] Discovery STM32F100RB - Trouble with timers and library structure

STM32F103 Nucleo boards e.g. STM Nucleo F103RB
User avatar
RogerClark
Posts: 7474
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: trouble with timers and library structure

Post by RogerClark » Mon Sep 25, 2017 10:18 am

Frank

I think you are installing correctly.

Did you restart the IDE after copying the files into the hardware folder

Also. You need to have the ARM compiler installed, so if you have uninstalled STM's core, you'll need to install the Arduino Due or Zero as either will install the ARM compiler that my repo uses.

zmemw16
Posts: 1486
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: trouble with timers and library structure

Post by zmemw16 » Mon Sep 25, 2017 10:41 am

this is my way of handling multiple cores of libmaple or stm32generic in residence, standard disclaimers apply.
@hdleng
ok, my hardware directory is under '/home/stephen/sketchbook' that is set in preferences

i've just edited platform.txt in the STM32F1 directory and added 'srp-' to the beginning of the name string.
fired up Arduino, then via tools->board-manager and had to scroll down a lot.
my drop-down has a black downward pointing triangle at the bottom.

Code: Select all

~/sketchbook/hardware/Arduino_STM32/STM32F1/platform.txt

Code: Select all

name=srp-STM32 Boards (STM32duino.com)
the effect is :-
Screenshot_2017-09-25_11-34-13.png
Screenshot_2017-09-25_11-34-13.png (166.73 KiB) Viewed 196 times
shame the help about button doesn't show installed cores :(
seems i also have the ST official cores installed.

Code: Select all

stephen@i71:~$ grep json ~/.arduino15/preferences.txt
boardsmanager.additional.urls=https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json
any help to you ?

stephen
this is my way of handling multiple cores of libmaple or stm32generic in residence, standard disclaimers apply.
Last edited by zmemw16 on Mon Sep 25, 2017 2:56 pm, edited 2 times in total.

User avatar
RogerClark
Posts: 7474
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: trouble with timers and library structure

Post by RogerClark » Mon Sep 25, 2017 11:11 am

There should be no need to edit files.

All STM32 cores should co-exist OK without renaming etc

I have my "LibMaple" based core and Daniel's STM32GENERIC in my hardware folder and they both work fine.

zmemw16
Posts: 1486
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: trouble with timers and library structure

Post by zmemw16 » Mon Sep 25, 2017 2:49 pm

there is a preponderance of 'i' in the post. i'll edit in a warning.

the cores reside together very nicely if you only have one of each i.e. one libmaple and one stm32generic, however i found that as boards exist in multiple cores, the 'core description' text in the drop down is identical.
i don't know how the hardware directory is read, which core is processed first etc.
so which core am i actually selecting a board from ?
if i want to try something in steves core, i'd need to rename it's top directory or delete yours, the same is true for stm32generic.
also seems i'd installed the ST cores.

that post describes how i dealt with it.

stephen

hdleng
Posts: 10
Joined: Sat Sep 23, 2017 3:21 am
Location: Arizona, USA

Re: trouble with timers and library structure

Post by hdleng » Mon Sep 25, 2017 7:56 pm

@zmemw16 and @roger,

Thank you for the continued help. I went to bed; I haven't been ignoring you. I see that we're in three widely separated time zones.

I seem to have Arduino IDE working for STM32. I simply uninstalled everything and then reinstalled according to your instructions. I am not aware that I did anything differently this time, but the results are successful. So, I must have mangled something on the previous attempt.

I appreciate your patience.

I can successfully compile the TimerInterrupts.ino for the Generic STM32F103C. The mcu on my Discovery Board is STM32F100RBT6B microcontroller, 128 KB Flash, 8 KB RAM in 64-pin LQFP. I can, of course, edit source files to address different I/O mapping. But the are differences in memory sizes (and perhaps on-chip peripherals). Is the a good way to adjust for that?

Thank you again for sticking with me,

Frank

zmemw16
Posts: 1486
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: trouble with timers and library structure

Post by zmemw16 » Mon Sep 25, 2017 10:18 pm

i don't think you'll need to do anything as a suitable linker file is provided in the core.
i don't know where or how it's generated.
the linker file does change with the particular board variant selected, not a good idea to try a larger chip :D
i think if you go through the boards.txt & platform.txt as an 'exercise', you'll probably find something.
stephen

User avatar
RogerClark
Posts: 7474
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: trouble with timers and library structure

Post by RogerClark » Mon Sep 25, 2017 10:31 pm

You will need to make a new "variant" if you want to make extensive changes

There is a variant folder for each main type F103 MCU.

But initially I would recommend you just edit one of the existing variants, as it will save messing around with adding a new section in boards.txt to use a new "variant"

hdleng
Posts: 10
Joined: Sat Sep 23, 2017 3:21 am
Location: Arizona, USA

Re: trouble with timers and library structure

Post by hdleng » Mon Sep 25, 2017 11:30 pm

@zmemw16, @roger,

An example of the incompatibility of the Discovery STM32F100 board with the Generic STM32F103C is the error " 'PC8' was not declared in this scope". I've determined that the board.h file does not have PC8 enumerated. Editing the enum fixes the compiler error (but, of course, that will create a bad binary). The board.cpp file contains the pin mapping, and I will have to edit it to correspond to my board. Then there's the board.txt and platform.txt that will need to be adjusted. I think that I will follow Roger's advice and simply edit an existing variant and get it working. I can add the Discovery Board properly afterwards.

You have been helpful in my learning the Arduino structure as it pertains to STM32.

Regards,

Frank

User avatar
RogerClark
Posts: 7474
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: trouble with timers and library structure

Post by RogerClark » Mon Sep 25, 2017 11:56 pm

Frank

You don't need to edit platform.txt for these sorts of changes.

You would only need to edit platform.txt if you have a different sort of upload method e.g. some other type of hardware programmer etc. Or you want to do something with the compiler options etc etc

The sort of changes you need can be done by editing the files in the variant folder and eventually, also changing boards.txt

BTW. The linker settings are in the *.ld files, its easy to change the RAM and Flash size

However 8k is not much RAM to play with... An empty sketch with USB support uses nearly.
You can often reduce RAM usage by selecting a different Optimisation setting. The default is for the smallest binary file, but I've noticed that this can result in more RAM usage.
AFIK 99% of things work on the default optimisation setting, but some things may not work if you select the higher optimisations (though I have not personally had any problems even at -O3 )

hdleng
Posts: 10
Joined: Sat Sep 23, 2017 3:21 am
Location: Arizona, USA

Re: trouble with timers and library structure

Post by hdleng » Tue Sep 26, 2017 12:06 am

Roger,

I'm working on it now, following your instructions as best as I can understand. It will take a day or so along with the rest of my work load. I will post again when I am successful (or at a hopeless stand still).

It has become obvious, as I explore the inner workings of STM32duino, that you have done a great deal of work. You are very generous, and you have my thanks.

Frank

Post Reply