HUB overflow problem. Help with first big build.
pgbpsu
Posts: 460
Although I've worked with the Prop for several years I'm only now getting into the Prop/C game. And frankly the reason I'm doing so now is because I've got a piece of hardware I'd like to test out with the Prop and the vendor provides example source code in C. My first thought was to attempt to translate it all to spin but its more than 60 files and since they provide it as C I thought this would be a good time to start learning C.
Well, maybe not. This beast is complicated. However, I thought it worth a try, maybe it won't be as difficult as I expect and I'll no doubt learn something along the way. After downloading the example code I attempted to make it on my Mac. One or two make commands and the whole thing compiled. Useless but not a bad start.
So I modified the make files to use PropGCC rather than GCC and started again. Using their make files (only altered by changing gcc to propgcc) things go smoothly until I get an out of HUB memory error:
Question number one:
Is there a way to compile something with propgcc without any restrictions on code size? I realize this may produce an output file that's too large to be useful but at this stage I just want to see the thing compile.
Question number two:
I'm doing this at the command line and with make. What options should I included to give this the best chance of compiling AND fitting into memory. The only boards I have access to are the Quickstart and the Gadget Gangster Propeller Platform USB with microSD.
If I can get this to compile, I'm going to invite a colleague who actually knows C to work with me to pare it down if necessary and to help understand what's going on.
I've attached the two make files in case they are helpful.
Thanks,
Peter
Well, maybe not. This beast is complicated. However, I thought it worth a try, maybe it won't be as difficult as I expect and I'll no doubt learn something along the way. After downloading the example code I attempted to make it on my Mac. One or two make commands and the whole thing compiled. Useless but not a bad start.
So I modified the make files to use PropGCC rather than GCC and started again. Using their make files (only altered by changing gcc to propgcc) things go smoothly until I get an out of HUB memory error:
/Applications/SimpleIDE/parallax/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/bin/ld: driver section `.hub' will not fit in region `hub' /Applications/SimpleIDE/parallax/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/bin/ld: region `hub' overflowed by 29516 bytes collect2: ld returned 1 exit status make: *** [driver] Error 1
Question number one:
Is there a way to compile something with propgcc without any restrictions on code size? I realize this may produce an output file that's too large to be useful but at this stage I just want to see the thing compile.
Question number two:
I'm doing this at the command line and with make. What options should I included to give this the best chance of compiling AND fitting into memory. The only boards I have access to are the Quickstart and the Gadget Gangster Propeller Platform USB with microSD.
If I can get this to compile, I'm going to invite a colleague who actually knows C to work with me to pare it down if necessary and to help understand what's going on.
I've attached the two make files in case they are helpful.
Thanks,
Peter
Comments
https://sites.google.com/site/propellergcc/documentation
This did the trick. Now on to loading this to the prop and making it useful...
Thanks,
p
This spells it out very nicely. Thanks for the link.
Sounds like a tall order.
It is a new way of thinking. Like Mike and others said, you can put the program on the SD card. Just for fun I added a few #includes for some *big* libraries. The program happily compiled and sent nearly a megabyte to the SD card.
It would appear that no longer do you have to worry so much about how big a program is. And given it doesn't matter, why not compile for speed rather than size (list box option bottom right of the screen).
I started again by loading all the necessary files from the existing directories into SimpleIDE. It took a bit to get all the #includes sorted out but in the end, the exact same code compiled and loaded. This time it did what it was supposed to! I also compiled it for lmm and loaded that which also worked great. I did notice a more stability and speed with the toggle rate of an SPI line in the system when using LMM vs XMM.
So it compiles and loads, now I just have to get it to do what I want.
Thanks for all the help here and for the great new option for the Prop.
Excellent. Thanks for the update.
BTW, current XMM variations are designed for the fastest possible execution with burst mode hardware. It is not necessarily designed for determinism. However, it is possible to recover determinism by forcing routines that need to be deterministic to live in HUB memory. Functions can be forced into HUB memory even in an XMM mode by prefixing the functions with HUBTEXT. I.e., void HUBTEXT foo();
Programming for a living most of my live I was able to avoid C pretty much. So I am sort of biased about C on the Prop. But now I am getting confused. Everybody complains about the disadvantage of the proptool compared to homespun and bstc because unused functions not get removed and the resulting binarys are to big to load.
and now this from Drac:
. Just for fun I added a few #includes for some *big* libraries. The program happily compiled and sent nearly a megabyte to the SD card.
so just including a library will add MBs of bytes in size? or is this still a question of 'needs to be done' somehow?
Dont get me wrong - I do support Parallax decision to go for GCC and really think the work the PropGCC-Team around Jazzed is amazing - but looking at the examples there is not much C-code nessessary to extend the ressources of a standard prop.
My question now is - does PropGCC supports removing unused code? Or would it make sense to write some 'precompiler' sort of software to take care of that? For some completly unrelated (work-) Stuff of mine I am thinking of/need to write something like that anyways, so I am brainstorming here...
Enjoy!
Mike
This happens most easily if one tries to use the full implementation of the C++ libraries. That is, std::cout and other std name spaces. Everything is there if one really want to use them, but it is not at all necessary to use those libraries. Libraries get pruned, but there are some things that are so big that they can't be pruned like the std namespace.
Enjoy!
Mike