Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ds18b20.o is defining things like "__TEXT_REGION_LENGTH__" #5

Closed
hydrogen18 opened this issue May 2, 2019 · 1 comment
Assignees
Labels

Comments

@hydrogen18
Copy link

@hydrogen18 hydrogen18 commented May 2, 2019

I have noticed a peculiarity with your output from the makefile. It defines things it really shouldn't, for example

ericu@raspberry:~/builds/avr-ds18b20$ avr-objdump -t obj/ds18b20.o 

obj/ds18b20.o:     file format elf32-avr

SYMBOL TABLE:
00000000 l    d  .text	00000000 .text
00000000 l    d  .data	00000000 .data
00000000 l    d  .bss	00000000 .bss
00000000 l    d  .comment	00000000 .comment
00000000 l    df *ABS*	00000000 onewire.c
0000003e l       *ABS*	00000000 __SP_H__
0000003d l       *ABS*	00000000 __SP_L__
0000003f l       *ABS*	00000000 __SREG__
00000000 l       *ABS*	00000000 __tmp_reg__
00000001 l       *ABS*	00000000 __zero_reg__
00000000 l    df *ABS*	00000000 ds18b20.c
0000003e l       *ABS*	00000000 __SP_H__
0000003d l       *ABS*	00000000 __SP_L__
0000003f l       *ABS*	00000000 __SREG__
00000000 l       *ABS*	00000000 __tmp_reg__
00000001 l       *ABS*	00000000 __zero_reg__
0000ffa0 g       *ABS*	00000000 __DATA_REGION_LENGTH__
00000078 g     F .text	00000068 onewireWriteBit
00000142 g     F .text	00000050 onewireReadBit
00000400 g       *ABS*	00000000 __LOCK_REGION_LENGTH__
00000422 g     F .text	00000060 ds18b20csp
000002e0 g     F .text	000000ba ds18b20rsp
000004ee g     F .text	000000d0 ds18b20rom
00000400 g       *ABS*	00000000 __SIGNATURE_REGION_LENGTH__
00000220 g     F .text	0000006e ds18b20match
00000482 g     F .text	0000006c ds18b20read
0000028e g     F .text	00000052 ds18b20convert
000001f8 g     F .text	00000028 ds18b20crc8
00000400 g       *ABS*	00000000 __USER_SIGNATURE_REGION_LENGTH__
00000192 g     F .text	00000066 onewireRead
00000000 g     F .text	00000078 onewireInit
0000039a g     F .text	00000088 ds18b20wsp
00010000 g       *ABS*	00000000 __EEPROM_REGION_LENGTH__
000000e0 g     F .text	00000062 onewireWrite
00000400 g       *ABS*	00000000 __FUSE_REGION_LENGTH__
00002000 g       *ABS*	00000000 __TEXT_REGION_LENGTH__

These values like __TEXT_REGION_LENGTH__ are actually chip specific (not even arch. specific). In my case I have lost about 2 hours trying to understand why avr-gcc thinks a 8kb program is too large.

Inspecting the object in obj/tmp/ds18b20.o reveals that these values are not present. They are somehow being added when your makefile does avr-ld -r ...

My suggestion would be to avoid using avr-ld in this way. I don't have enough experience with the avr gcc compiler to know how to avoid these symbols

@Jacajack Jacajack self-assigned this May 2, 2019
@Jacajack

This comment has been minimized.

Copy link
Owner

@Jacajack Jacajack commented May 2, 2019

I updated the makefile, so the final static library is no longer created from obj/ds18b20.o. Now, in fact, the linker is never invoked. avr-objdump -t lib/libds18b20.a does not contain the symbols that were causing problems for you.

Thank you for spending your time working things out and reporting this issue. I've had no idea such problem existed, because I've never had any problems with previous makefile setup or avr-ld itself.

@Jacajack Jacajack closed this May 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.