# migratting from PIC to ARM questions and experince

Status
Not open for further replies.

#### Electro nS

##### Full Member level 6
i am a novice PIC18F and 24F programmer (3 years experience only )
i have to jump into the world of 32bit processors due to coming projects that require heavy processing and my laziness toward fixed point , optimizing math and using scaling to change matlab and some algorithms codes to more PIC friendly codes
my first attempt is the PIC32 , since i am familiar with PIC products and compilers
but i am so frustrated and tired of waiting for a PIC32 with builtin FPU, and motor control periphirals
so i can use the same processors for most of my projects even if that donot require the same processing horse power , since i work mainly alone and donot have time to migrate between devices .

So after some research i found that STM32F4 does cover my current needs and could be future proof for 2 years or so (according to my requirements )

I want to know what is the best tool (compiler toolchain linker .... ) to get started free or licensed no problem .
and i am interested in how difficult is getting started and how low level is programming on these devices

when programmming PIC i use MPlabx and XC , and my code is C (not C++) and i donot use the periferal libraries (due to bad documentation) i use family reference manual and create my own functions for initializing port and peripherals and interrupt service routines (most difficult part).

is this methods possible with STM32F4 arm microcontrollers or is the programming via high level language functions ?

please guide me and give me your expertize on this subject i am lost :bang: :thinker: :roll:

thanks and regards and sorry for this very long POST :thumbsup:

#### bigdogguru

There are several reasonably good compiler toolsets available for development with the ARM Cortex-Mx series, they all have their advantages and disadvantages.

The KEIL MDK-ARM compiler toolset is my personal preference, it is available for use under several license editions/levels, MDK-Lite, MDK-CortexM, MDK-Standard, and MDK-Professional. The MDK-Lite edition is a free license, with a code size limitation of 32KB, I would suspect more than enough for most motor control applications, and can be later upgraded with the purchase of a license key. ARM, Ltd, which actually designs and licenses all ARM cores to various manufactures, actually owns or has a controlling interest in KEIL, which is why the ARM and KEIL banners are prominently visible on both their sites. Therefore, KEIL certainly receives the latest updated support from ARM, Ltd and one of the most widely used ARM compiler toolsets available.

KEIL MDK-ARM Microcontroller Development Kit

Compare MDK Editions

KEIL MDK-ARM allows coding in C, inline assembly language and straight ARM/Thumb/Thumb2 Assembly Language depending on the specific ARM target device, there maybe also a C++ option as well, however I have not used it as yet.

The ARM Cortex-Mx series have the Cortex Microcontoller Software Interface Standard (CMSIS) libraries available for development, there are entire textbooks and websites devoted to the CMSIS libraries, therefore the libraries are well supported and have a wide following.

CMSIS - Cortex Microcontroller Software Interface Standard

The Designer's Guide to the Cortex-M Processor Family: A Tutorial Approach

ST also provides their STM32CubeFx libraries for use with their ARM Cortex-Mx series of microcontrollers.

Of course, you are allows free to development your own libraries if you desire or build higher level libraries based on the CMSIS libraries.

BigDog

Electro nS

### Electro nS

Points: 2

#### Electro nS

##### Full Member level 6
KEIL MDK-ARM allows coding in C, inline assembly language and straight ARM/Thumb/Thumb2 Assembly Language depending on the specific ARM target device, there maybe also a C++ option as well, however I have not used it as yet.

The ARM Cortex-Mx series have the Cortex Microcontoller Software Interface Standard (CMSIS) libraries available for development, there are entire textbooks and websites devoted to the CMSIS libraries, therefore the libraries are well supported and have a wide following.

ST also provides their STM32CubeFx libraries for use with their ARM Cortex-Mx series of microcontrollers.

BigDog

Thank you very much for the time and extensive reply
So now i decided to go for the Keil and have downloaded the lite version and planing on buying license if later i need it.

just for my clarification : if i use those CMSIS libraries , i can later migrate my code to another arm processor from different vendor (ex: ti, nxp ..)
while the stm32cube is specific for ST and doesn't provide easy migration , right ??

also does using stm32cube provide an advantage of libraries for the peripherals found on ST version of the ARM processor , i understand that different vendors have same processor but different peripherals right ?? So CMSIS libraries are targeted toward the more general (or common) core ?

regards

#### bigdogguru

just for my clarification : if i use those CMSIS libraries , i can later migrate my code to another arm processor from different vendor (ex: ti, nxp ..)

ARM, Ltd designs and licenses the ARM core designs to various manufacturers whom then package the ARM core design with several peripheral modules, this maintains a certain level of cross manufacturer compatibility, thorough the standardization of common core architecture, assembly languages, etc. However, there maybe variations in the naming of various core register or bit identifiers, particularly in specific compiler header files. Of course, the manufacturer added peripherals and features tend to be specific to that manufacture, therefore while not terribly difficult, porting code from one vendor's ARM to another, will typically require some code modifications and identifier substitutions. The CMSIS libraries can greatly simply this task by providing a common API across all ARM Cortex-Mx devices, regardless of the manufacturer.

while the stm32cube is specific for ST and doesn't provide easy migration , right ??

Correct, the STM32CubeFx libraries are specific to the ARM Cortex-Mx devices manufactured by ST.

also does using stm32cube provide an advantage of libraries for the peripherals found on ST version of the ARM processor , i understand that different vendors have same processor but different peripherals right ??

Perhaps, although my experience with the STM32CubeFx is limited in comparison with the CMSIS libraries, I suspect the STM32CubeFx libraries may provide a bit greater flexibility with peripheral configuration as they are geared specifically towards STM32 ARM Cortex-Mx devices.

So CMSIS libraries are targeted toward the more general (or common) core ?

No, the CMSIS libraries are actually composed of several modules, CMSIS-CORE, CMSIS-SVD, CMSIS-DAP, CMSIS-DSP, CMSIS-DRIVER and CMSIS-RTOS, along with code templates.

CMSIS - Cortex Microcontroller Software Interface Standard
The ARM® Cortex® Microcontroller Software Interface Standard (CMSIS) is a vendor-independent hardware abstraction layer for the Cortex-M processor series and specifies debugger interfaces. Creation of software is a major cost factor in the embedded industry. By standardizing the software interfaces across all Cortex-M silicon vendor products, especially when creating new projects or migrating existing software to a new device, means significant cost reductions.

The CMSIS enables consistent and simple software interfaces to the processor for interface peripherals, real-time operating systems, and middleware. It simplifies software re-use, reducing the learning curve for new microcontroller developers and cutting the time-to-market for devices.

I believe the STM32CubeFx libraries have incorporated several modules of the CMSIS libraries and provided them as examples, I would recommend downloading the STM32CubeF4 and taking a look.

STM32CubeF4

ST also offers the STM32CubeMx, which is a GUI to help generate the necessary header files with the required pin and hardware configurations. I've not had the time or opportunity to test it as yet.

If you have not already, you might consider purchasing a JTAG/SWI programmer/debugger, as in circuit debugging of complex applications is almost a necessity. There are several on the market, some even open source devices, however my preference is for the Segger J-Link, almost all offer driver support for KEIL, so that is rarely an issue.

Segger Debug Probes - J-Link and J-Trace

Segger also offers an educational license version of their J-Link, the J-Link EDU which is functionally identical with their professional version.

ST also markets a JTAG/SWI programmer/debugger specific to their devices, I have not had any experience with their device, other than the embedded version on their Discovery series of dev boards.

BigDog

Electro nS

### Electro nS

Points: 2

#### Electro nS

##### Full Member level 6
Again i found this quiet helpful , i am on the right track now

the j-link EDU is reasonably priced , and it can be bought online without student certification i guess , so i might give it a try at 60$, while the st link v2 is at 24$ is very tempting and it is found on Discovery and nuecleo for free.

i wounder what is the difference between both (excuse me i am a NOOB at debugging tools and their features and specifications) , can you tell me what do you is better and more future proof (in terms on bigger projects not time)

#### bigdogguru

The major difference is the Segger J-Link will allow you the ability to program and debug virtually any ARM device from any manufacturer, the ST-Link would limit you to programming/debugging their devices only. So is the extra $35 worth the significant increase in versatility? In my opinion, Yes. Besides, most ARM development boards come equipped with the a standard 14-pin JTAG port or some variation, which the J-Link simply plugs into and you can then program and debug the target ARM while in circuit. You may want to buy a few inexpensive ARM dev boards designed around various manufacturers ARM microcontrollers, then the J-Link is the way to go. The J-Link also has other utilities available, which I rarely use, some of which may require an additional license depending on the version of J-Link you own. I actually own two J-Link Pro's and have been very satisfied with them. They are not inexpensive, however Segger does an excellent job of releasing firmware updates for all of their devices. As new ARM devices are released on the market, you simply download the firmware, driver and software updates, free from the Segger website. You should also be aware, there are quite a few Chinese clones of the J-Link available, however Segger has begun taking steps to "brick" or disable counterfeit clones of their devices when used with Segger software. At$60, why bother with counterfeit clones?

BigDog

Electro nS

Points: 2