i'm starting to learn arm cortex-m  - Page 1
Forum section: electronics / beginners

author: saeed.GH
author_rank: Newbie
timestamp: August 24, 2017, 07:30:07 am
content: what way is better for start learn ARM cortex-m ?what language is better c or c++ ?

author: Mechatrommer
author_rank: Super Contributor
timestamp: August 24, 2017, 08:25:24 am
content: Quote from: saeed.GH on August 24, 2017, 07:30:07 amenglish or englishkidding. what is better? yes either c or c++ ... but of course you will see some avionics guys chiming inno pun intended...

author: saeed.GH
author_rank: Newbie
timestamp: August 24, 2017, 08:29:17 am
content: I am a newbie.please help me.

author: abraxa
author_rank: Frequent Contributor
timestamp: August 24, 2017, 09:42:23 am
content: How old are you, Saeed?

author: stmdude
author_rank: Frequent Contributor
timestamp: August 24, 2017, 09:56:32 am
content: When you're starting out, you should use the language that _you_ are most knowledgeable in first, as long as it will work at all on an MCU.Once you've gotten things working, you can switch languages to fit your needs (performance, power, code-size, etc, etc), but when you're _just_ starting out, your main objective is to get something working, and you don't need an extra hurdle to achieve that goal by using a language that you're not comfortable in.

author: LabRat
author_rank: Contributor
timestamp: August 24, 2017, 10:06:34 am
content: Hi Saeed,I had similar queries when I started out in Cortex-M programming. Not so much a question of "better" but what would fit best into what I was trying to achieve.C is almost an exact subset of C++ and so you generally get a bigger toolset with C++. If you have experienced functional or object oriented programming in the past this may also push you towards C or C++ respectively.Most embedded programmers use C and as such the bulk of embedded code is written in C. Some sources will talk about C++ compilers not being as optimised as C compilers but from what I understand this is not really the case.It may also depend on what development environment you wish to use. MBED is great for beginners and many of the libraries are written in C++ so would be easier to follow and use if you understood what was happening from a language perspective. I'm just getting my head round Eclipse (a different IDE with ARM plugins) at the moment.I plumped for C++ as I was more comfortable with object oriented design, wanted to start with MBED (though you can write code on MBED with C) and as I code for myself had free choice.Hope this helps.

author: metRo_
author_rank: Regular Contributor
timestamp: August 24, 2017, 12:07:31 pm
content: A great bookhttps://www.cs.indiana.edu/~geobrown/book.pdf

author: chris_leyson
author_rank: Super Contributor
timestamp: August 24, 2017, 12:22:00 pm
content: I've been playing with a few Arm Cortex-M processors just out of curiosity while I'm between jobs, need to move on from Microchip PICs. I would say pick whatever language you are most comfortable with, in my case it's C because I'm not an embedded software guy but I can see the advantages of C++.NXPs MBED is cheap and easy to get started with but lacks debugging. BTW NXP have recently released MCUxpresso tool suite with support for Kinetis processors.

author: Kjelt
author_rank: Super Contributor
timestamp: August 24, 2017, 12:26:47 pm
content: Step 1: choose your microcontroller, the major difference between manufacturers is in the peripherals not in the arm core.Step 2: choose or get the IDE belonging to the choosen microcontroller and its HAL softwareStep 3: See which language the software is written (>80% chance on C).So you are asking about step 3 which language you should start, that IMO is opposite to the direction you should follow.

author: danadak
author_rank: Super Contributor
timestamp: August 25, 2017, 11:11:52 am
content: Consider PSOC, tools, compiler free.For me what stands out is -1) Routability2) Fast 12 bit SAR A/D and slow 20 bit DelSig3) DFB (Digital Filter Block) that is dual channel, handle FIR or IIR filters, or DFBcan be used as a GP fast processor block, similar to RISC block4) MSI logic elements GUI based and/or the UDB Verilog capability. Eg. the FPGAlike capability5) Onboard Vref6) IDAC, VDAC, OpAmps (up to 4), comparator, mixer, switch cap, analog mux....7) LCD, COM, UART, I2C, I2S, One Wire, SPI, Parallel, LIN, CAN, BLE, USB9) Custom components capability, create with schematic capture or Verilog10) DMA to offload processes like filters, COM, Display11) ARM M0 (PSOC 4) or M3 (PSOC 5LP) or 8051 core(PSOC 3) or M0+/M4 dual core PSOC 612) Extensive clock generation capabilities13) All components supported by extensive prewritten APIshttps://www.element14.com/community/thread/23736/l/100-projects-in-100-days?displayFullThread=truehttp://www.cypress.com/documentation/code-examples/psoc-345-code-examplesGreat video libraryAttached component list. A component is an on chip HW resource.Free GUI design tool with schematic capture, "Creator". Components have rich API library attachedto each component. Compilers free as well.PSOC 4 is low end of family, consider 5LP parts as well. PSOC 4 also has arduino footprint boards (pioneer) as well. PSOC 6 dual core M0+/M4.https://www.elektormagazine.com/labs/robot-build-with-cypress-psochttp://www.cypress.com/products/32-bit-arm-cortex-m-psochttps://brightcove.hs.llnwd.net/e1/uds/pd/1362235890001/1362235890001_5241352463001_2606504288001.mp4?pubId=1362235890001&videoId=2606504288001Regards, Dana.

author: brucehoult
author_rank: Super Contributor
timestamp: August 25, 2017, 12:52:24 pm
content: Quote from: saeed.GH on August 24, 2017, 07:30:07 amAssembler, surely, otherwise you won't see any difference between ARM and AVR or whatever.Note that Cortex M uses the Thumb2 instruction set only.If you don't know either C or C++ and you want to do low level programming then start with C first and learn it well and learn how it maps to the machine: registers, memory, instructions.That said, I almost always use the C++ compiler, even if I'm programming using only features found in C. The results will be identical, but using the C++ compiler gives the options of using both C and C++ libraries. Ability to create and use more powerful libraries is the major reason for C++ to exist.