quick question about relative labels.

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

Guys, how do I create a relative label?  See below my effort:

 

EXAMPLEPATH = examples/

obj-y += EXAMPLEPATH/rtos/fior_am/hal/interrupt_gateway.o

Last Edited: Fri. Dec 3, 2021 - 12:46 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You going to have to say what language & tools you're talking about.

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: 0

Isn't he simply talking about Makefiles then? 

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

Shit! Sorry guys, I should have said this pertains to make files.

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

A path is relative as long as its not anchored to the root of a drive/filesystem (x: in Windows, / in Linux) 

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

Hi clawson, my problem is I've hit the 8K limit on compilers object list.  So I want to take address for example, "

EXAMPLEPATH = examples/

 

obj-y += examples/rtos/fior_am/hal/context.o

and change it to the following using a relative address.

EXAMPLEPATH = examples/rtos/

obj-y += EXAMPLEPATH/hal/context.o

 

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

I was told to use relative paths in the make file to get around the 8k object list make.exe. If I use the below it simple replaces the label which is not what I want to do.

 

RTOS := examples/rtos


obj-y += $(RTOS)/fior_am/hal/context.o

 

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

As I understand OP's motivation,

an attempt to run make resulted in an error

message that a list object was more than 8K.

OP is trying to reduce the size of the object file list by using relative paths.

Is this correct?

 

More information would be nice.

The actual file and the error message would be especially good.

 

My crystal ball does not tell me whether the

offending list object is actually a list of object files.

 

Where is make being run?  A source directory? a sub-directory? somewhere else?

How does it know where source file are and the object files belong?

Usually either source files or object files are easy enough to refer to with relative paths.

 

All OPs examples use relative paths.

If obj-y really is the offending list object,

OP will need a shorter way to say things like examples/rtos/fior_am/hal/context.o .

If OP has an OS that supports them,

a soft link to examples/rtog/fior_am/hal might be in order.

Moderation in all things. -- ancient proverb

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

I can't remember the details but doesn't Makefile have the concept of "VPATH" or something like that? so you can set that (a bit like "cd...") and then the paths to local objects can be shorter being relative to that anchor point.

 

(personally I'd put the effort into learning CMake not Makefiles and let CMake handle all the Makefile generation problems that might occur!)

 

EDIT : see https://www.cmcrossroads.com/article/basics-vpath-and-vpath

and

https://www.gnu.org/software/make/manual/html_node/General-Search.html

Last Edited: Fri. Dec 3, 2021 - 07:39 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

GNU make has the --directory option that

affects its notion of the working directory.

That in turn affects how relative file paths

(source and object) are interpreted.

If object and source directories are not related,

either source files or object files are likely to have long prefixes.

Of course, /tmp/foo is a short prefix.

 

I do not remember exactly what vpath and VPATH do,

just that I didn't like it.

Their interpretations depend on the contents of directories.

Moderation in all things. -- ancient proverb