Author Topic: SAM C first project  (Read 1289 times)

0 Members and 1 Guest are viewing this topic.

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17814
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
SAM C first project
« on: July 11, 2019, 08:33:08 pm »
Right, got a SAM C 21J explained board. Fired up MPLAB and started a "blank project" and oh... I have two files made by microchip that are full of code one has a bunch of names of things that it itself doen not recognise. Can i just scrap these and get on with my own thing?
 

Offline malagas_on_fire

  • Frequent Contributor
  • **
  • Posts: 591
  • Country: pt
  • Kernel Panic
    • Malagas Lair
Re: SAM C first project
« Reply #1 on: July 11, 2019, 09:10:22 pm »
From  the looks of the manual they start with download Atmel Studio 7... on page 6-

http://ww1.microchip.com/downloads/en/DeviceDoc/70005318A.pdf

Edit; If this is you're board...

« Last Edit: July 11, 2019, 09:12:57 pm by malagas_on_fire »
If one can make knowledge flow than it will go from negative to positve , for real
 

Offline malagas_on_fire

  • Frequent Contributor
  • **
  • Posts: 591
  • Country: pt
  • Kernel Panic
    • Malagas Lair
Re: SAM C first project
« Reply #2 on: July 11, 2019, 10:21:33 pm »
If one can make knowledge flow than it will go from negative to positve , for real
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17814
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: SAM C first project
« Reply #3 on: July 12, 2019, 06:34:58 am »
See if this helps:

https://www.microchip.com/forums/m1096683.aspx



not really. I have started a blank project only to find it populated with some unexplained code. If I wanted that crap i would have used the graphical interface woo woo just to do a proper job of having a load of useless and uninteligible code spat at me. I just wanted a start from scratch barebones project. Also the pint of the SAM C device, it's an ARM but a simple one that is easy enough to just write code for without resorting to undocumented middleware crap.
 

Offline westfw

  • Super Contributor
  • ***
  • Posts: 4199
  • Country: us
Re: SAM C first project
« Reply #4 on: July 12, 2019, 07:46:22 am »
Maybe take a look at https://github.com/WestfW/SAMD10-experiments ?It's been a while, and ... it looks like I started with an "example project" and cut things out rather than starting from scratch, but there are a bunch of notes on dealing with a bunch of the Atmel Annoyances.
In particular, Atmel considers the core CMSIS defintions to be part of ASF, so you probably want to do at least some partial setup of ASF and "#include <asf.h>" even if you're not planning on using any of the ASF library functions.


 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17814
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: SAM C first project
« Reply #5 on: July 12, 2019, 07:49:52 am »
Put it this way, MPLABX is complaining about it own code! loads of the variables or whatever they are are in error, way to go microchip, start a "blank" project with a load of code you yourselves have problems with.
 

Offline JPortici

  • Super Contributor
  • ***
  • Posts: 3461
  • Country: it
Re: SAM C first project
« Reply #6 on: July 12, 2019, 08:10:52 am »
I tried, just for kicks with my ATSAMC21 XPLAINED board.
I created a blank project and it was blank.
I added a c file (not a "c main file") and it was just an empty file, that's it.

I coded something simple, compile, done.

Your experience may vary though, i used MPLAB X 5.15 and XC32 V2.15, support is still marked as beta. Maybe in 5.20 they changed things, but i won't try it.
5.20 is a bugged pile of garbage, incompatible with projects from the previous version.

Unfortunately i don't know when i'll have time to do something more meaningful to help you..
« Last Edit: July 12, 2019, 08:14:17 am by JPortici »
 

Offline cv007

  • Frequent Contributor
  • **
  • Posts: 825
Re: SAM C first project
« Reply #7 on: July 12, 2019, 08:12:39 am »
>populated with some unexplained code

I created a project in mplabx (5.15) for a C21Jsomething, created the standard/mostly empty newmain.c file, and using xc32 v2.20. I can't even compile without error, as it cannot find core_cm0plus.h, and still cannot find it when I add the directory in include settings. I don't know what is going on. I also have the arm gcc compiler added to the build tools, and I would guess that probably works fine but didn't want to take the time to also sort out adding the startup file, linker script, include directories, etc.

In the other thread, Alex showed a link to his github directory for sam parts. He also has a command line programmer app that may work also. I have a samd10xplained project on github, but it is in c++ and probably shouldn't be seen anyway, so will not link to it here. To make mine work I needed the atmel dfp pack, the cmsis pack, the arm gcc compiler, and the programmer app from Alex. I then wrote my own script to do the stuff a makefile does- clean,compile,create lss/hex/bin, program, gitupdate, etc.

me-
>But whether you use xc32 or arm gcc, you may have to fiddle around a little to make it work right.
you-
>So why will i have to fiddle to get the compiler to work? if the compiler works for the chip and the IDE uses it what is the problem?
 

Offline legacy

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: SAM C first project
« Reply #8 on: July 12, 2019, 08:57:01 am »
These things are made with the RAD philosophy in mind.
RAD stands for _R_apid _A_pplication _D_evelopment.
so, if you find that Microchip's approach annoying,
don't even try the Infineon's DAVE! It's even worse.
 

Offline malagas_on_fire

  • Frequent Contributor
  • **
  • Posts: 591
  • Country: pt
  • Kernel Panic
    • Malagas Lair
Re: SAM C first project
« Reply #9 on: July 12, 2019, 08:57:38 am »
See if this helps:

https://www.microchip.com/forums/m1096683.aspx



not really. I have started a blank project only to find it populated with some unexplained code. If I wanted that crap i would have used the graphical interface woo woo just to do a proper job of having a load of useless and uninteligible code spat at me. I just wanted a start from scratch barebones project. Also the pint of the SAM C device, it's an ARM but a simple one that is easy enough to just write code for without resorting to undocumented middleware crap.

My point is to create a simple project on the atmel studio 7 eg a led blinking or something else and import into MPLABX, since the support to SAM boards is still in progress. Yesterday i tried to create a project with that processor on MPLAX 5.20 for linux x64 and i couldn't even install CMSIS and DPF on the packs window..... so really premature.

to import create a new project and select import atmel studio project. 

Also beware to install the ARM toolchain:

https://www.microchip.com/mplab/avr-support/avr-and-arm-toolchains-c-compilers

« Last Edit: July 12, 2019, 09:03:17 am by malagas_on_fire »
If one can make knowledge flow than it will go from negative to positve , for real
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf