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

Generated C code does not compile #13

Open
davidcock opened this issue Oct 20, 2014 · 3 comments
Open

Generated C code does not compile #13

davidcock opened this issue Oct 20, 2014 · 3 comments
Assignees

Comments

@davidcock
Copy link
Contributor

Particularly the class.c files, example (from specs/uart):

davec@dwarrowdelf:uart$ cc -I. -I../include -o class.o -c class.c
class.c:4:13: error: redeclaration of enumerator ‘bits5’
bits5, bits6, bits7, bits8
^
In file included from class.c:1:0:
./class.h:6:13: note: previous definition of ‘bits5’ was here
bits5, bits6, bits7, bits8
^
class.c:4:20: error: redeclaration of enumerator ‘bits6’
bits5, bits6, bits7, bits8
^
In file included from class.c:1:0:
./class.h:6:20: note: previous definition of ‘bits6’ was here
bits5, bits6, bits7, bits8
^
class.c:4:27: error: redeclaration of enumerator ‘bits7’
bits5, bits6, bits7, bits8
^
In file included from class.c:1:0:
./class.h:6:27: note: previous definition of ‘bits7’ was here
bits5, bits6, bits7, bits8
^
class.c:4:34: error: redeclaration of enumerator ‘bits8’
bits5, bits6, bits7, bits8
^
In file included from class.c:1:0:
./class.h:6:34: note: previous definition of ‘bits8’ was here
bits5, bits6, bits7, bits8
^
class.c:5:11: error: conflicting types for ‘wl_t’
} wl_t;
^
In file included from class.c:1:0:
./class.h:7:11: note: previous declaration of ‘wl_t’ was here
} wl_t;
^

Nothing in specs/uart_exynos compiles at all.

@ryzhyk ryzhyk self-assigned this Oct 20, 2014
@ryzhyk
Copy link
Member

ryzhyk commented Oct 20, 2014

Thanks, should be fixed now. Also, you should not need to generate a .c file for class.tsl. Normally, you need to generate a .c/.h pair for the synthesised driver, and only .h for all the files that it imports.

@davidcock
Copy link
Contributor Author

OK, that looks better, but I now can't see how to generate code for a non-root spec. For example, I can synthesis main.tsl with "termite -i main.tsl -g", but I can't call "termite -i drv.tsl -g", as it complains with:

termite: user error (validation error: drv.tsl:5:39: Unknown template name: uart_linux)

In the previous commit I managed it with "termite -i main.tsl -g drv.tsl", but that now gives a command-line error.

@ryzhyk
Copy link
Member

ryzhyk commented Oct 21, 2014

This happens due to a mismatch between C #include semantics and TSL imports. In TSL, the contents of all files imported from anywhere in the spec becomes globally visible to all other files. In the hindsight, this was a bas idea, as TSL does not force each file to import all of its dependencies. I should add a check to force this to the TSL compiler. In the meanwhile, the solution is to add the missing imports to drv.tsl. I did this for spi_exynos and uart_exynos specs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants