1

Sorry if this is a noobie question but I've been trying to get this set up for a few days and I'm still struggling.

I haven't done embedded C in a couple of years and I'm trying to get back into it. I'm using a SAMD21E18 microcontroller which I want to program in C. I've been able to setup the IDE and compiler, and flashed some very basic code to the board to test everything. Thats all working fine.

My problem is that I can't figure out how to add the correct header files to my project. A good guide that I've been following is this. In the "Startup, System and Linker files" section, they write "From the SDK copy the system, startup and linker files to the project folder", but they don't really explain where to find them. I've been able to locate the startup and system files but I'm struggling to find the header files. Is anyone able to offer some advice on how I could find or generate these?

MendelumS
  • 147
  • 2
  • 16
  • 1
    What header files do you want to add? – user1850479 Nov 29 '21 at 02:26
  • 1
    What is your goal? Are you setting up a development enviroment at work or is this for a hobby project? There is a **steep** learning curve to set up CMake for an embedded project, if you have not done this before. For a professional enviroment, this is the way to go, but if it's your hobby project, you may be better off using the IDE supplied by the manufacturer, or something like PlatformIO. – Armandas Nov 29 '21 at 03:03
  • All embedded system tool chains come with this stuff already in place. Linker setup, linker scripts, ICD drivers, C language CRT, MCU-specific register maps and libs, debugger support. And so on. These are part of the specific tool chain product. In this case MCUxpresso, so I guess what you refer to is the libs from MCUxpresso. I totally understand why you wouldn't want to use MCUxpresso since that's a complete trash tool, but manually setting up Visual Studio instead just sounds painful. How are you doing to debug? I'd recommend buying a commercial tool instead, it will save you months. – Lundin Nov 29 '21 at 07:16
  • Btw... MCUxpresso is the NXP/Freescale tool. You are apparently using Microchip/Atmel SAM, so you are looking at the wrong tool chain. Atmel Studio is based on Visual Studio and comes with all of this in place too. It isn't great but it's much better than the Eclipse trashware from NXP. – Lundin Nov 29 '21 at 07:19
  • @user1850479 its nothing specific yet tbh as I haven't really started coding, but one example is samd.h which gives me an error. I just know that its going to keep happening so I need to get it setup properly now rather than later – MendelumS Nov 29 '21 at 16:33
  • @Armandas Yes im setting up a dev environment. Just want to be able to write my code, compile, then flash to my MCU. I tried to get Atmel studio but I'm on Linux so I can't use it, maybe I'll check out Platform IO – MendelumS Nov 29 '21 at 16:35
  • @Lundin can't use Atmel studio unfortunately as I'm on Linux. But I tried it out on Windows and it didn't seem to actually create the files I'm looking for. The toolchain I think I need is this, would it be correct? https://github.com/ARM-software/CMSIS_5/tree/develop/CMSIS/Core – MendelumS Nov 29 '21 at 16:45
  • This doesn't fully answer my question but it is very helpful so thought I'd post here for future reference: https://electronics.stackexchange.com/questions/394217/arm-cortex-cores-with-peripherals-basic-requirements?rq=1 – MendelumS Nov 29 '21 at 17:00
  • @MendelumS The toolchain is https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads CMSIS library has a Vendor-specific files, so you should get them from Microchip. I downloaded `samd21n_getting_started` example and CMSIS files are there. That example should contain all the files needed to build the project. – Armandas Nov 30 '21 at 04:19
  • @MendelumS Developing embedded systems on Linux is a major pain - you'll end up relying on various hobbyist open-source solutions and how good the tools are depend entirely on how active such projects are. Been there done that, I built my own ICD at one point... If you enjoy fooling around with stuff like that as a hobby, then by all means go ahead. But if you want a professional setting where things need to be up and running in a somewhat timely manner and where you need to focus on troubleshooting the application, not the tools, then I'd recommend Windows and professional tool chains. – Lundin Nov 30 '21 at 11:01
  • All - *Please be nice* and comply with the site's [Code of Conduct](/help/conduct) (CoC) in everything you write. Nothing snarky / sarcastic / condescending (or worse). Some comments here were deleted after being flagged. [Polite constructive criticism](https://meta.stackexchange.com/questions/19756) is allowed in comments - with the emphasis on *polite* & *constructive*. Also please check especially that a comment still complies with the CoC, if it includes the words "you" or "your". Thanks for your understanding. – SamGibson Nov 30 '21 at 13:15

0 Answers0