Is this possible in PropGCC?
Brian Fairchild
Posts: 549
(for more background see my 'frustrations' topic)
At run time I want the following...
8 COGs each running their own PASM code
32k of data in HUB RAM
Which is quite achievable by the silicon.
The problem in SPIN appears to be that all addresses in the 32k boot memory image must be unique. You can't reclaim/overlay DAT space after COGs have loaded for variable use.
What about PropGCC? Can I do this directly or will it be necessary to use some kind of overlay loader?
At run time I want the following...
8 COGs each running their own PASM code
32k of data in HUB RAM
Which is quite achievable by the silicon.
The problem in SPIN appears to be that all addresses in the 32k boot memory image must be unique. You can't reclaim/overlay DAT space after COGs have loaded for variable use.
What about PropGCC? Can I do this directly or will it be necessary to use some kind of overlay loader?
Comments
Having written some test SPIN code I can see what the problem is. The 32k image contains everything exactly where it ends up at boot time. Even large blank areas for variables. Trying to reclaim that space is a kludge at best as, without some extreme care, there's no way to guarantee that your PASM/DAT code is contiguous.
As an example in C I want to...
declare 24 1kbyte arrays
write 8 cog files which run standalone (mcog or PASM) which use those arrays
write a main file which starts the whole thing running
...and have the compiler do what it should which is hide where those arrays are and deal with all the address references. If I want to I should be able to declare the arrays as global and pick up their address in the cog code.
Here is an example of how to write an ECOG C program like David mentions with SimpleIDE. David's example in the Propeller-GCC Demos v0-3-4 package is much more interesting, but it's not a .side project yet.
Hey Rick! Another toggle demo for ya!
Thanks,
--Steve
I tried to compile this project. There is a errormessage: ecogc_toggle.c:20:17: fatal error: i2c.h: No such file or directory.
Where should this header be ? Where is information about the i2c driver ?
Is there further information how this cogc and ecogc things work.
Where is this magic "extern unsigned int _load_start_toggle_fwcog[]" and how does it get its name. From the c-filename?
Is that the only magic or is there something hidden:
propeller-elf-gcc.exe -r -Os -mcog -o toggle_fw.cog -xc toggle_fw.cogc
propeller-elf-objcopy --localize-text --rename-section .text=toggle_fw.cog toggle_fw.cogIgnoring "Simple printf" flag in COG mode program.
Thanks!
Please update your installation to the latest packages. Minimum requirements are SimpleIDE v0-7-2 and Propeller-GCC v0-3-4. Both are in one of the latest SimpleIDE packages.
I'll fire up some hardware later and have a play.
That is strange! Why I had downloaded 0-6-12 ? I thought I followed Daniel Harris' link.
Anyway with the newest version it compiles.
Thank you.
But there is to much magic!
Why is '_load_start_toggle_fw_0_ecog' the address for cognewFromBootEeprom ?
Is there a memory-map where I can see what the compiler did ?
What address is 0xc0000000 (used in COG_IMAGE_EEPROM_OFFSET) ?
I want to understand what's going on.
Thank you.
Right-click on a project manager source file name. Then click "Show Map File".
The map file is not pretty, but it has everything you need.
_load_start_toggle_fw_0_ecog is the address because that's the symbol defined in the tools.
They can be read as _load_start_<filename>_cog or _load_start_<filename>_ecog.
In SimpleIDE:
filename.cogc and extensions will be addressable as _load_start_filename_cog.
filename.ecogc and extensions will be addressable as _load_start_filename_ecog.
The .cogc file binaries (.cog) are loaded in the HUB RAM for LMM programs.
The .ecogc file binaries (.ecog) are saved to eeprom for LMM/XMM programs.
Unnecessary. I forgot. We need to document this better.
1) get a strong coffee
2) print out all the docs
3) go sit in the garden and have a read
3) might be difficult as it's summer here in the UK.
Do I understand that correct now?
Linker puts all ecog-code (Code from file with extension ecogc) from address 0xc0000000 upward. Loader puts that code not to hub but to whatever memory is connected to propeller and described in board.cfg (and of course supported by the loader).
_load_start_toggle_fw_0_ecog is an address in that ecogc section and loader knows to read that from external memory to buffer in hub and from there to cog memory.
Ok, but I do not like the idea to have special filenames with multiple mains. That is strange.
And if I have to use filenames for addressing than it is magic not c.
I would expect to define sections and have "normal" c-files. That would be the standard way.
#if(_CODEVERSION == ECOG)
section ("cog1")
_NATIVE
#endif
void cogfunction1(volatile struct PARAMETER * p)
{
...
}
#if(_CODEVERSION == ECOG)
section ("cog2")
_NATIVE
#endif
void cogfunction2(volatile struct PARAMETER * p)
{
...
}
What is the reason to choose such a mysterious way? Is there some problem I do not see?
Ok, for beginners or spin-users this is maybe the more understandable way, but I thought you want to address c-users?
In answer to your other questions, yes it is possible to use sections to handle this. In fact, that is exactly what happens to these .ecogc programs when they're compiled. They get put into sections whose names end in ".ecog". The linker knows to place those sections in high memory and to define symbols that identify the starting and ending address of each of these sections. This could be done without any loader magic but would require a custom linker script for each program. That is still possible with Propeller GCC. This is just an easier and more automated way of doing this.
Do not understand me wrong. You did a good job and it is good that simpleIDE do this in background.
I program now for about ten years (job-related) with c on microcontrollers and I had never to edit a makefile or linker script. Thanks to HEW(Renesas) and MPLAB.
But the way it is done here, I think, is not good for understanding what is going on.
Changing the file extension is a strange way and make files incompatible with other editors (syntax highlighting).
Why you do not make (virtual) folders like ecogc in projekt manager.
I put the c file in ecog, SimpleIDE generates then automatically a headerfile with
This headerfile I include and things are more logical and c conform.
Anyway it would be good to see all Headerfiles (even the library headers) in projekt manager after first compiling.
And search in project files is also missing.
My wish for project manager would be: