hackndev / zinc

The bare metal stack for rust
zinc.rs
Apache License 2.0
1k stars 100 forks source link

Add expand target to Makefile #323

Closed niclashoyer closed 8 years ago

niclashoyer commented 9 years ago

I added an expand target that'll print the expanded source code to stdout.

As for now it will just print the example program. Does anyone know if it is possible to expand different files, e.g. a register definition containing ioregs!, so one could verify the generated structs?

hacknbot commented 9 years ago

Can one of the admins verify this patch?

farcaller commented 9 years ago

that's actually a known PITA for me (as svd files are a mess). You can get ioreg source code from within the macro, but you can't pass any flags to the compiler that are available in the plugin scope AFAIK. What we can do, maybe, is to store generated code to intermediate dir? Not sure if it's available somehow.

niclashoyer commented 9 years ago

Yes I thought about that, too. So one could just browse some directory inside target that contains only expanded files. Unfortunately I did not find any flags to generate something like that using cargo.

farcaller commented 9 years ago

You can get a set of --cfgs from plugin, trigger on, say, emit_ioreg and dump all ioreg generated source to file from within the plugin.

posborne commented 9 years ago

This looks very handy. I have manually done this several times for the ioreg definitions as well both to debug and as a quick way to remind myself of what methods are provided.

mcoffin commented 8 years ago

We don't have a Makefile anymore in the build system at all, this patch is pretty obsolete, and I'm going to go ahead and close it. If you want to somehow add this to the current build system, please rebase off of master and re-submit.