New Project Main.C file Question

Go To Last Post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello Fellow AVR Freaks,

 

When I start a new project in Atmel Studio 7 it creates a block of comments at the top of the file. See below. 

 

/*
 * GccApplication1.c
 *
 * Created: 7/18/2021 5:18:13 PM
 * Author : Paul
 */ 
 

Is there any way to change this?

 

It's not a problem, I just manually add the Doxygen commands I want, but it would be nice if it was there automatically.

 

Thanks for your help,

Paul

 

 

You never know where life is going to take you; sit back and enjoy the ride!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

PaulieT wrote:
It's not a problem

It is just a comment. Every AS does have it, either for C or ASM template. You can edit it as you like.

Last Edited: Sun. Jul 18, 2021 - 09:38 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Or simply delete the created main.c and put your own version in.

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If I am not mistaken, PaulieT was looking for a way to edit the source of that comment so that every time a new file is created the custom comment would be inserted...

 

Edit: I have desired this myself.

David

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Create a text file with whatever you want and save it somewhere, then just copy and paste it into main.c? How many new projects an hour will you be creating that requires such automation? laugh

John Samperi

Ampertronics Pty. Ltd.

https://www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

IIRC, a template is in a zip.

General Settings | Microchip Studio

User Project Templates Location

via search for 'template'.

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

While the solution is to create a new set of desired files, then File-Export Template, then choose that when you create a new project it is possible to "hack" the default templates. Have a look at:

 

The one used when you pick:

 

 

is GccCFile.zip. If you look at that:

 

 

and take a look at that .c file:

 

 

So you could copy that, edit it, reZIP it and put it there and see what happens ;-)

 

(Perhaps simply exporting your own Template is easier though ?)

 

To add to GChapman's link also look at this section of the user manual: https://onlinedocs.microchip.com...

 

Oh and if you wondered about the $safeitemname$, $date$, $user$ seen above... https://onlinedocs.microchip.com...

Last Edited: Mon. Jul 19, 2021 - 08:21 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

https://www.avrfreaks.net/forum/as6-how-change-header-comment-template-author-name-and-other-things

 

PaulieT wrote:
When I start a new project in Atmel Studio 7 it creates a block of comments at the top of the file

it doesn't always get that right:

 

https://www.avrfreaks.net/forum/atmel-studio-puts-wrong-name-auto-generated-file-header-comment

 

frown

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Thanks for all the suggestions,

 

I tried editing the item Template and put it into the Zip file, but it didn't work. I still had the default comments. 

I also tried putting the new Template in the Cache folder, still no good. 

 

I'm going to do what JS suggested and simply copy my comment block into Main.c

 

Regards,

Paul

You never know where life is going to take you; sit back and enjoy the ride!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

PaulieT wrote:
I also tried putting the new Template in the Cache folder, still no good. 
Try a cache clear.

Installation and Updates | Microchip Studio

[2/3 page]

This [cache clear] is done by deleting the folder: %localappdata%\Atmel\AtmelStudio\7.0 from the Windows File Exporer.

 

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


 

 

 

I just got SysInternals (invaluable!) Process Monitor ( https://docs.microsoft.com/en-us... ) to watch as I created a new GCC executable project and what I actually see happening is:

 

 

so for the early stages of the project creation it is using stuff under "ProjectTemplatesCache\CandCPP\" with the AS7 directories but that's just to get a suitable project icon. I then see it using things like those .vstemplate files (XML) to create a .atsln file (first created in %TEMP%) which is then copied into the destination directory. I see something similar for the .cproj but the most interesting thing is what happens next:

 

 

so the "template" it uses actually seems to be a file from the "packs" directories. In fact this file:

 

 

So it would appear that now that "packs" are used these days it's getting its templates from a completely different place. As a quick experiment:

 

(note I had to use Admin privilege here!)

 

Now when I start a new project...

 

 

However this is very much a "hack".

 

Just to it the "proper way" with the Template exporter.

 

PS and in case anyone is curious: Kilroy... https://en.wikipedia.org/wiki/Ki...

 

PPS worth visiting that page simply to see:

 

 

Last Edited: Tue. Jul 20, 2021 - 09:10 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


clawson wrote:

 

Aha!  So it is using the wrong $blah$ token: the file it creates it calls main.c  - not <project>.c !

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...