compiler or linking option? -

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

In my project there are some files or routines that are not needed in the final hex/elf file.
How do I instruct Studio that they should not be linked/compiled?

Reason: I am porting a project to a smaller device and skipping all the stuff that is not really needed by uncommenting in the source. Unfortunately it is still being put in the final hex file.

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

Check this thread: https://www.avrfreaks.net/index.p...

and this one: http://www.nongnu.org/avr-libc/u...

As always, RTFM and do a search on your question in the forum before posting.

Stu

Engineering seems to boil down to: Cheap. Fast. Good. Choose two. Sometimes choose only one.

Newbie? Be sure to read the thread Newbie? Start here!

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

Hi Stu,

Many thanks!

adding the compiler and linker options in studio4 did the trick. I feel stupid to have asked that question since there is quite a lot of info availlable in this forum. Unfortunately there is hardly a good way for searching when one uses the wrong keyword(s). Many people get too often the rtfm reply when stuck. Does not help at all. Sometimes beginners do not know where to look or how to search or how to interpret the results c.q the manual. E.g. I still haven't grasped the stream uart_putchar, uart_getchar controlled by interrupts in separate files (not in main.c). I seem to have some problems with definitions in the different header files. My knowledge of C is apparantly not good enough.
I'll will ask later some questions about this. And I hope not to get the rtfm reply since I am still reading tfm!

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

nick-123 wrote:
Many people get too often the rtfm reply when stuck. Does not help at all.
Yeah, sometimes finding what you need in the manual can be frustrating. Been there, done that, have the T-shirt, bought the mug, T-shirt is ripped, mug is broken... :wink: It's why I also included the links.
nick-123 wrote:
Sometimes beginners do not know where to look or how to search or how to interpret the results c.q the manual. E.g. I still haven't grasped the stream uart_putchar, uart_getchar controlled by interrupts in separate files (not in main.c). I seem to have some problems with definitions in the different header files.
Post your question is a separate thread. That way, when someone else has the same question, perhaps it will pop up on a forum search. :)
nick-123 wrote:
My knowledge of C is apparently not good enough. I'll will ask later some questions about this. And I hope not to get the rtfm reply since I am still reading tfm!
Try posting a simple example that you cannot get working when you have problems. Oft-times the problem is really quite simple. Oh, and be sure to enclose your code in the [ code] and [/code] brackets (see the "Code" button on the submission form), it makes the code much easier to read.

We're not anti-newbie here, but I guess (as in all forums) the "old-timers" (which I am far from) get tired of answering the same questions. That's why I am answering - trying to pick up some slack for the "old-timers" and give them a break.

Good luck!

Stu

Engineering seems to boil down to: Cheap. Fast. Good. Choose two. Sometimes choose only one.

Newbie? Be sure to read the thread Newbie? Start here!

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

Before I forget

CFLAGS += -ffunction-sections
LDFLAGS += -Wl,-gc-sections

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

Not directly related to what you were after in the first place - but a lot of people have a lot of fun with -mrelax too. (search should find it)