Shop OBEX P1 Docs P2 Docs Learn Events
SD library in C — Parallax Forums

SD library in C

DavidZemonDavidZemon Posts: 2,973
edited 2013-12-08 18:36 in Propeller 1
I am trying to write an SD library using my generic SPI library and it isn't going well. Most of the time, I get 0x01 from CMD0, but I have yet to get anything other than 0xff or 0x7f as the first byte from CMD8. I've tried referencing fsrw and safe_spi but, as far as I can tell, I'm doing the same thing.

What could cause me to receive 0x01 from CMD0 followed by an invalid response from CMD8?

Code can be found here and the relevant files are SD_Driver.*, sd.*, and maybe spi* but I believe the SPI library is working.
https://github.com/SwimDude0614/PropWare

Thanks,
David
«1

Comments

  • DavidZemonDavidZemon Posts: 2,973
    edited 2013-04-05 00:44
    Problem found a fixed. I figured out how to use the logic analyzer on my DSO Quad and wow. What a nice tool!

    Anyway, CMD9 is responding with 0x01 as the first byte... it's idle. Why? The only issue I'm noticing is that there's a weird hickup in MISO a little before the half-way point of the argument.

    After I receive 0x01 as the first byte, an error is thrown and the program quits. I commented out that debug line once and only ever received 0xff following the idle response , making me think that the 0x01 response is not a fluke - it truly is in the idle state.

    A snapshot of only CMD9 can be found here, and the complete file (type VCD) can be found here.
    (Sorry chip select isn't there. I only have two probes at the moment and had to use a jumper wire just to get the third signal. Two more probes have been ordered...)
  • DavidZemonDavidZemon Posts: 2,973
    edited 2013-04-11 17:00
    Huge progress in the last week. I am now able to simulate the 'ls' and 'cat' unix commands. That is, print the contents of the current directory and print to screen a file in the current directory.

    Also, I guess I forgot to update this thread - I changed the git repository completely and reorganized. The new link is here and in the first post.
  • David BetzDavid Betz Posts: 14,516
    edited 2013-04-11 17:13
    Huge progress in the last week. I am now able to simulate the 'ls' and 'cat' unix commands. That is, print the contents of the current directory and print to screen a file in the current directory.

    Also, I guess I forgot to update this thread - I changed the git repository completely and reorganized. The new link is here and in the first post.
    I didn't have a chance to look at this until just now. Very nicely written code!
  • DavidZemonDavidZemon Posts: 2,973
    edited 2013-04-12 18:34
    Thanks! I've been working very hard on "readable code" lately.

    I would be interested in the opinions of some other developers on a specific question though. One of the things I like about C/C++ is header files, and how perfect they are for documentation. I like having pre-processor definitions, function prototypes (and function docs) and various other things in the header because it creates a separation that allows for each searching/finding. However, I was recently introduced to the idea of "private" functions in C by placing the prototypes in the source file (as opposed to header) which imply that those functions are therefore inaccessible from other files. Seemed brilliant and I have used this method for PropWare so far. The bad news though, is that it has destroyed some of the readability and searchability of my code. For instance, the first executable line of sd.c is line 250+; past definitions, global variable declarations and function documentation/prototypes.
    What would you suggest I do? Forget about having "private" functions? Accept the decrease in readability and leave it as is? Create a second header file for private information? Another option?
  • Heater.Heater. Posts: 21,230
    edited 2013-04-13 01:39
    Just put all your function and variable declarations in the same header file and add "static" to all the ones that should not be used from outside. I generally put all my static functions at the bottom of the header file with the public interfaces at the top.

    You might also want to use some naming convention for you public interfaces like prefixing all function names. for exaample:

    int SDSD_mount(....):

    Then we all know this function belongs to SwimDudes SD library and is less likely to conflict with other libraries we might use.
  • TorTor Posts: 2,010
    edited 2013-04-13 04:04
    Yes, make them static as Heater said. And then you also don't need the prototypes, they will only create additional work (to keep them lined up with the actual functions). Instead, let them self-prototype. You do that simply by stacking them so that any function called by function A is placed above function A in the source file. Nicely sorted, and makes it easier to find functions too, without tools.. the function you call is always earlier in the file than the function you're looking at.
    You will only need prototypes for some very few special cases:
    a) Recursive functions
    b) Functions calling each other (this is pretty rare)
    So, for your 'top down' coding, start by implementing the 'top' function, then keep placing the more detailed functions above that one in the source file.
    And obviously this will lead to 'main()' being at the bottom of the file, which is why you see that so often.
    My files generally look as follows:

    Include statements for system header files
    Include statements for other, non-system header files (e.g. my other libraries)
    Include statements for local header files (these will typically have prototypes for my non-static functions)
    static variables, if any
    static functions (i.e. private to this file), nicely sorted so that they self-prototype.
    public functions, and prototypes for these are in one of the local header file(s) included above

    (The reason I call it 'self-prototyping' is that the compiler will check the parameters just as if you had actual prototypes. Just like a Pascal compiler would, as Pascal programs are generally laid out the same way, with the callee function above the caller function).

    -Tor
  • TorTor Posts: 2,010
    edited 2013-04-13 04:06
    Heater. wrote: »
    Just put all your function and variable declarations in the same header file and add "static" to all the ones that should not be used from outside.
    Actually I just noticed a problem with part of the above.. I definitely don't recommend putting static variables in header files. That will simply result in a local variable being allocated in every file that include said header file. That is normally not what you want. Variables and code should as a rule never be in a header file, only declarations.

    -Tor
  • Heater.Heater. Posts: 21,230
    edited 2013-04-13 06:26
    Tor, yes you are right. Don't put static variables in header files..

    But wait a minute, if you have all your functions defined in your C file before they are used (a good idea) why have any static function declarations in you header either?
    It's a contradiction, the header file says "look I have these functions" and the "static" says "but you are not allowed to use them.

    Things get a bit more complex if you library is big enough to warrant living in multiple C files. Then you might want a second header file declaring all the private functions that are shared between files and cannot be static.
  • TorTor Posts: 2,010
    edited 2013-04-13 08:03
    Essentially you never need static function prototypes in header files.. or nothing static there at all (so no static variables either). And as I argued earlier, there is almost never a need for prototypes for static functions at all, except when cross-calling each other (and then you would put them in the C file anyway, as the major point of header files is to export something so that other files can get access through declarations).
    The only items I put in header files are prototypes for public functions (and I slap an 'extern' on them too), and #defines for constants and macros.
    And if I used global variables (which I don't) they would be declared as'extern int glob_var;' in a header file. If I used global variables.. which I don't.

    -Tor
  • jazzedjazzed Posts: 11,803
    edited 2013-04-13 08:16
    I used to declare all external declarations in headers extern, but not anymore because of this:

    "For external declarations the default storage class specifier will be extern and for internal declarations it will be auto. The only exception to this rule is the declaration of functions, whose default storage class specifier is always extern." http://publications.gbdirect.co.uk/c_book/chapter8/declarations_and_definitions.html
  • TorTor Posts: 2,010
    edited 2013-04-13 08:17
    Heater. wrote: »


    Things get a bit more complex if you library is big enough to warrant living in multiple C files. Then you might want a second header file declaring all the private functions that are shared between files and cannot be static.

    "Internal" library functions (shared between functions in the library, but not with the user of the library) I obviously declare in header files, the difference between these header files and the "public" header files is that my 'make install' target won't copy those header files into the public
    'include/ ' directory. So they stay in the directory/directories where the library source is, they'll never migrate to /usr/include/ or the equivalent place on whatever target it is.

    Of course C has this slightly weak spot that these non-public, but non-static functions are still visible in the global namespace.. and could be accessed by someone using the library even though they are meant for library-internal use. The user would be without the prototypes and would have to figure out how to use the functions (and maybe writing their own protoptypes). And, seen from the library writer point of view, you should think about namespace pollution and not give function names that may collide with something else to your internal, but non-static functions. Don't call them sort() or compare(), for example.. better use e.g. tf_lib_internal_sort() or something.

    -Tor
    (sorry about a couple of spurious line shifts in the above, the forum software sometimes won't let me delete empty lines when I'm in the Android browser)
  • TorTor Posts: 2,010
    edited 2013-04-13 08:21
    jazzed wrote: »
    I used to declare all external declarations in headers extern, but not anymore because of this:

    "For external declarations the default storage class specifier will be extern and for internal declarations it will be auto. The only exception to this rule is the declaration of functions, whose default storage class specifier is always extern." http://publications.gbdirect.co.uk/c_book/chapter8/declarations_and_definitions.html
    Yes, extern is default, but I continue using the practice anyway for various reasons. One of them is that it looks neater, and you'll see the standard headers in /usr/include still use 'extern' for all function prototypes.

    -Tor
  • Dave HeinDave Hein Posts: 6,347
    edited 2013-04-13 08:31
    In cases where I want to include static variables and/or initialization values I use an "#ifdef _MAIN_PROGRAM_" in the header file, and I define _MAIN_PROGRAM_ in the file that contains my main() function. This may not be the best programming practice, but it works for me, and I only need one version of the header file.
  • DavidZemonDavidZemon Posts: 2,973
    edited 2013-04-13 13:19
    Upon reading the above I've made some changes.

    I like the idea of static functions. It was not something I was previously aware of. Also, as I mentioned earlier, I like the idea of documentation for functions staying in the header file(s) and, for that, it makes sense to have prototypes in the headers. Results: I've done as Heater first suggested and moved definitions and prototypes to the header file, at the bottom, with functions be preceded by the static keyword. (Thankfully, I was already aware of the static keyword for variables.)

    I also began the implementation of SPIShiftIn_fast and *Out_fast. I like how fsrw and SD_MMC_FATEngine use the counter module, so that's my end goal. For now, I've simply created routines that do not call another asm function to clock out, but rather call "xor" twice in a row.

    Also, any way a moderator could change the thread title to "PropWare - Generic C library files"?
  • DavidZemonDavidZemon Posts: 2,973
    edited 2013-04-17 04:37
    The shell continues to evolve and errors continue to be fixed. Turns out I was not previously able to read multi-cluster files. That's fixed now. I've also added the "cd" command to the shell and fully tested the system on FAT32 as well.

    Unfortunately... it's extremely slow. With all debugging turned off and using my SPIShiftIn_fast routine, it took many minutes (I didn't time it, but I think ~5) to read an 8 MB mp3 file. When I have time, SPI speed will be the first thing I optimize. Specifically, an entire GAS routine that reads a block and writes it to HUB memory one long at a time.
  • DavidZemonDavidZemon Posts: 2,973
    edited 2013-04-19 23:26
    The library continues to progress and become more flexible. I've updated the way files work to be very similar to POSIX standards (pretty sure I'm using the right words here) and functions like SDfopen take a filename and a file pointer as their parameters.

    I've also recorded the code size of the SD demo with various options enabled/disabled. Here are the results:
    Enabled Code Options						CMM Mode		LMM Mode
    None								7124			11340
    SD_DEBUG							10480			17048
    SD_DEBUG, SD_VERBOSE						17492			29628
    SD_DEBUG, SD_VERBOSE, SD_VERBOSE_BLOCKS				17816			30196
    SD_DEBUG, SD_SHELL						15708			27508
    SD_SHELL							14624			25904
    All								19220			Overflowed by 1760
    

    I'm not entirely happy with this. It wasn't but a couple days ago that, without any options enabled, CMM mode was around 5k. This also does not include write functionality, and I know that's going to add a significant chunk of code.

    Now I have two big things I'd like to fix when I'm done with the necessary functions: 1) read/write speed, 2) code size.
  • DavidZemonDavidZemon Posts: 2,973
    edited 2013-04-22 07:01
    This is likely the last major update for a few weeks. I've finished the bare-minimum requirements to move forward with my senior design project: read from and write to an SD card. Until the end of semester at least, any further updates will be minor (two that I'm considering on optimized block read/write and multi-block file buffers).

    This most recent update has added a few new functions: SDfputc, SDfputs, SDftellw, SDftellr, SDfseekw, and SDfseekr. The tell* and seek* are for the independent read and write pointers. I know that isn't quite POSIX standard, but until I'm done with senior design (it's more useful to me this way), that's how it's going to stay.

    I also found a stupid mistake in my option definitions and the code size has been updated below to reflect it (namely, the shell is a lot smaller) :
    Enabled Code Options                        CMM Mode        LMM Mode
    None                                        7872            12920
    __simple_printf only                        10344           17288
    SD_DEBUG                                    11284           18704
    SD_DEBUG, SD_VERBOSE                        17996           30576
    SD_DEBUG, SD_VERBOSE, SD_VERBOSE_BLOCKS     18308           Overflowed by 112
    SD_DEBUG, SD_SHELL                          12464           20996
    SD_SHELL                                    11320           19316
    All                                         19700           Overflowed by 2672
    
  • DavidZemonDavidZemon Posts: 2,973
    edited 2013-05-05 01:37
    It's been hell, but I finally finished an initial implementation of file creation and additions (ability to make a file longer than it was upon opening it). Directories should also be able to be expanded but I didn't bother testing it.

    I wasn't planning on doing this for my project but an overall simplification required that I be able to append to and create new files.

    I'll update with code sizes later... it's grown quite a bit. Good news is, if you don't need to write to files, you can disable that option and the code size should remain very similar to the numbers listed in my previous post.

    As always, code available here: https://github.com/SwimDude0614/PropWare
  • DavidZemonDavidZemon Posts: 2,973
    edited 2013-12-03 12:17
    I'm doing two major changes to propware and could use some help with the second one.

    1) I'm starting the implementation of Doxygen for PropWare. Current progress (based on the master branch of the git repo) can be found here: http://david.zemon.name/professional/PropWare/docs/html/
    2) I realized the stupidity of my ways and am now compiling PropWare into a static library. Progress on this has been moved to the development branch (https://github.com/SwimDude0614/PropWare/tree/development)

    When I attempt to build the SPI demo, I get undefined reference errors. Does anyone know why? I'll post full output from the library compilation in a reply to this post.
    Building file: ../SPI_Demo.cInvoking: PropGCC Compiler
    /home/david/reusable/SimpleIDE-0-9-40/parallax/bin/propeller-elf-gcc -I/home/david/External/Kits/Embedded/Parallax/Library/PropWare -I/home/david/reusable/SimpleIDE-0-9-40/parallax/propeller-elf/include -Os -mlmm -Wall -o SPI_Demo.o -c ../SPI_Demo.c
    ../SPI_Demo.c:10:16: warning: return type of 'main' is not 'int' [-Wmain]
    /home/david/External/Kits/Embedded/Parallax/Library/PropWare/spi.h:259:23: warning: 'SPIReadPar' declared 'static' but never defined [-Wunused-function]
    /home/david/External/Kits/Embedded/Parallax/Library/PropWare/spi.h:268:16: warning: 'SPICountBits' declared 'static' but never defined [-Wunused-function]
    /home/david/External/Kits/Embedded/Parallax/Library/PropWare/spi.h:281:16: warning: 'SPIGetPinNum' declared 'static' but never defined [-Wunused-function]
    Finished building: ../SPI_Demo.c
     
    Building target: SPI_Demo.elf
    Invoking: PropGCC Linker
    /home/david/reusable/SimpleIDE-0-9-40/parallax/bin/propeller-elf-gcc -mlmm -fno-exceptions -fno-rtti -L/home/david/reusable/SimpleIDE-0-9-40/parallax/propeller-elf/lib -L/home/david/External/Kits/Embedded/Parallax/Library/PropWare/Debug -lPropWare -o SPI_Demo.elf SPI_Demo.o
    SPI_Demo.o: In function `_main':
    (.text+0x58): undefined reference to `_SPIStart'
    SPI_Demo.o: In function `_main':
    (.text+0xac): undefined reference to `_SPIShiftOut'
    SPI_Demo.o: In function `_main':
    (.text+0xb4): undefined reference to `_SPIWait'
    SPI_Demo.o: In function `_main':
    (.text+0x108): undefined reference to `_SPIShiftIn'
    collect2: ld returned 1 exit status
    make: *** [SPI_Demo.elf] Error 1
    
  • DavidZemonDavidZemon Posts: 2,973
    edited 2013-12-03 12:18
    libPropWare.a is compiled with the following commands:
    Building file: ../PropWare.c
    Invoking: PropGCC Compiler
    /home/david/reusable/SimpleIDE-0-9-40/parallax/bin/propeller-elf-gcc -I/home/david/External/Kits/Embedded/Parallax/Library/PropWare -I/home/david/reusable/SimpleIDE-0-9-40/parallax/propeller-elf/include -Os -mcmm -Wall -o PropWare.o -c ../PropWare.c
    Finished building: ../PropWare.c
     
    Building file: ../spi.c
    Invoking: PropGCC Compiler
    /home/david/reusable/SimpleIDE-0-9-40/parallax/bin/propeller-elf-gcc -I/home/david/External/Kits/Embedded/Parallax/Library/PropWare -I/home/david/reusable/SimpleIDE-0-9-40/parallax/propeller-elf/include -Os -mcmm -Wall -o spi.o -c ../spi.c
    ../spi.c: In function 'SPIStart':
    ../spi.c:37:16: warning: unused variable 'str' [-Wunused-variable]
    ../spi.c: In function 'SPISetMode':
    ../spi.c:126:10: warning: unused variable 'str' [-Wunused-variable]
    ../spi.c: In function 'SPISetBitMode':
    ../spi.c:146:10: warning: unused variable 'str' [-Wunused-variable]
    ../spi.c: In function 'SPISetClock':
    ../spi.c:165:10: warning: unused variable 'str' [-Wunused-variable]
    ../spi.c: In function 'SPIGetClock':
    ../spi.c:188:10: warning: unused variable 'str' [-Wunused-variable]
    ../spi.c: In function 'SPIShiftOut':
    ../spi.c:211:10: warning: unused variable 'str' [-Wunused-variable]
    ../spi.c: In function 'SPIShiftIn':
    ../spi.c:237:16: warning: unused variable 'str' [-Wunused-variable]
    ../spi.c: At top level:
    /home/david/External/Kits/Embedded/Parallax/Library/PropWare/spi.h:268:16: warning: 'SPICountBits' declared 'static' but never defined [-Wunused-function]
    /home/david/External/Kits/Embedded/Parallax/Library/PropWare/spi.h:281:16: warning: 'SPIGetPinNum' declared 'static' but never defined [-Wunused-function]
    Finished building: ../spi.c
     
    Building file: ../spi_as.S
    Invoking: PropGCC Assembler
    /home/david/reusable/SimpleIDE-0-9-40/parallax/bin/propeller-elf-gcc -I/home/david/External/Kits/Embedded/Parallax/Library/PropWare -I/home/david/reusable/SimpleIDE-0-9-40/parallax/propeller-elf/include -o spi_as.o -c ../spi_as.S
    Finished building: ../spi_as.S
     
    Building file: ../sd.c
    Invoking: PropGCC Compiler
    /home/david/reusable/SimpleIDE-0-9-40/parallax/bin/propeller-elf-gcc -I/home/david/External/Kits/Embedded/Parallax/Library/PropWare -I/home/david/reusable/SimpleIDE-0-9-40/parallax/propeller-elf/include -Os -mcmm -Wall -o sd.o -c ../sd.c
    ../sd.c: In function 'SDCreateFile':
    ../sd.c:1815:10: warning: unused variable 'uppercaseName' [-Wunused-variable]
    ../sd.c: At top level:
    /home/david/External/Kits/Embedded/Parallax/Library/PropWare/spi.h:259:23: warning: 'SPIReadPar' declared 'static' but never defined [-Wunused-function]
    /home/david/External/Kits/Embedded/Parallax/Library/PropWare/spi.h:268:16: warning: 'SPICountBits' declared 'static' but never defined [-Wunused-function]
    /home/david/External/Kits/Embedded/Parallax/Library/PropWare/spi.h:281:16: warning: 'SPIGetPinNum' declared 'static' but never defined [-Wunused-function]
    Finished building: ../sd.c
     
    Building file: ../l3g.c
    Invoking: PropGCC Compiler
    /home/david/reusable/SimpleIDE-0-9-40/parallax/bin/propeller-elf-gcc -I/home/david/External/Kits/Embedded/Parallax/Library/PropWare -I/home/david/reusable/SimpleIDE-0-9-40/parallax/propeller-elf/include -Os -mcmm -Wall -o l3g.o -c ../l3g.c
    /home/david/External/Kits/Embedded/Parallax/Library/PropWare/spi.h:259:23: warning: 'SPIReadPar' declared 'static' but never defined [-Wunused-function]
    /home/david/External/Kits/Embedded/Parallax/Library/PropWare/spi.h:268:16: warning: 'SPICountBits' declared 'static' but never defined [-Wunused-function]
    /home/david/External/Kits/Embedded/Parallax/Library/PropWare/spi.h:281:16: warning: 'SPIGetPinNum' declared 'static' but never defined [-Wunused-function]
    ../l3g.c:140:9: warning: 'L3GWrite16' defined but not used [-Wunused-function]
    Finished building: ../l3g.c
     
    Building file: ../mcp300x.c
    Invoking: PropGCC Compiler
    /home/david/reusable/SimpleIDE-0-9-40/parallax/bin/propeller-elf-gcc -I/home/david/External/Kits/Embedded/Parallax/Library/PropWare -I/home/david/reusable/SimpleIDE-0-9-40/parallax/propeller-elf/include -Os -mcmm -Wall -o mcp300x.o -c ../mcp300x.c
    /home/david/External/Kits/Embedded/Parallax/Library/PropWare/spi.h:259:23: warning: 'SPIReadPar' declared 'static' but never defined [-Wunused-function]
    /home/david/External/Kits/Embedded/Parallax/Library/PropWare/spi.h:268:16: warning: 'SPICountBits' declared 'static' but never defined [-Wunused-function]
    /home/david/External/Kits/Embedded/Parallax/Library/PropWare/spi.h:281:16: warning: 'SPIGetPinNum' declared 'static' but never defined [-Wunused-function]
    Finished building: ../mcp300x.c
     
    Building file: ../hd44780.c
    Invoking: PropGCC Compiler
    /home/david/reusable/SimpleIDE-0-9-40/parallax/bin/propeller-elf-gcc -I/home/david/External/Kits/Embedded/Parallax/Library/PropWare -I/home/david/reusable/SimpleIDE-0-9-40/parallax/propeller-elf/include -Os -mcmm -Wall -o hd44780.o -c ../hd44780.c
    Finished building: ../hd44780.c
     
    /home/david/reusable/SimpleIDE-0-9-40/parallax/bin/propeller-elf-ar rs libPropWare.a PropWare.o spi.o spi_as.o sd.o l3g.o mcp300x.o hd44780.o
    /home/david/reusable/SimpleIDE-0-9-40/parallax/bin/propeller-elf-ar: creating libPropWare.a
    
  • jazzedjazzed Posts: 11,803
    edited 2013-12-03 12:25
    /home/david/reusable/SimpleIDE-0-9-40/parallax/bin/propeller-elf-gcc -mlmm -fno-exceptions -fno-rtti -L/home/david/reusable/SimpleIDE-0-9-40/parallax/propeller-elf/lib -L/home/david/External/Kits/Embedded/Parallax/Library/PropWare/Debug -lPropWare -o SPI_Demo.elf SPI_Demo.o
    
    -lPropWare should be at the end of the command.
  • DavidZemonDavidZemon Posts: 2,973
    edited 2013-12-03 12:32
    That's an easy fix at least.

    Now the linker can't find my assembly (spi_as.S).
    undefined reference to `__load_start_spi_as_cog'
    
  • jazzedjazzed Posts: 11,803
    edited 2013-12-03 14:23
    That's an easy fix at least.

    Now the linker can't find my assembly (spi_as.S).
    undefined reference to `__load_start_spi_as_cog'
    

    To get "__load_start_spi_as_cog" it seems that you need this: .section .spi_as_cog, "ax"

    Add -Xlinker -MAP=map_file to your gcc line so you can see all symbols in map_file.
    SimpleIDE has a "Show Map File" command that does this for us.

    Symbols like __load_start_* are always at the end of the map file.
  • DavidZemonDavidZemon Posts: 2,973
    edited 2013-12-03 15:16
    I've edited line 36 of the assembly file slightly, to match what you suggested.

    I'm not 100% sure what your suggestion was with the map file, but I added the arguments to the linker flags and here's the output now when I attempt to build SPI_Demo.elf. The output when building the library hasn't changed (because it's not running the linker)
    Building file: ../SPI_Demo.cInvoking: PropGCC Compiler
    /opt/parallax/bin/propeller-elf-gcc -I../../.. -I/opt/parallax/propeller-elf/include -Os -mlmm -Wall -o SPI_Demo.o -c ../SPI_Demo.c
    ../SPI_Demo.c:10:16: warning: return type of 'main' is not 'int' [-Wmain]
    ../../../spi.h:275:23: warning: 'SPIReadPar' declared 'static' but never defined [-Wunused-function]
    ../../../spi.h:284:16: warning: 'SPICountBits' declared 'static' but never defined [-Wunused-function]
    ../../../spi.h:297:16: warning: 'SPIGetPinNum' declared 'static' but never defined [-Wunused-function]
    Finished building: ../SPI_Demo.c
     
    Building target: SPI_Demo.elf
    Invoking: PropGCC Linker
    /opt/parallax/bin/propeller-elf-gcc -mlmm -fno-exceptions -fno-rtti -Xlinker -MAP=map_file -L/opt/parallax/propeller-elf/lib -L../../../Debug -o SPI_Demo.elf SPI_Demo.o -lPropWare
    Archive member included because of file (symbol)
    
    
    ../../../Debug/libPropWare.a(spi.o)
                                  SPI_Demo.o (_SPIWait)
    ../../../Debug/libPropWare.a(PropWare.o)
                                  ../../../Debug/libPropWare.a(spi.o) (_PropWareCountBits)
    /opt/parallax/propeller-elf/lib/libc.a(fputc.o)
                                  SPI_Demo.o (_fputc)
    /opt/parallax/propeller-elf/lib/libc.a(fopen_intern.o)
                                  SPI_Demo.o (___files)
    /opt/parallax/propeller-elf/lib/libc.a(default_io.o)
                                  /opt/parallax/propeller-elf/lib/libc.a(fopen_intern.o) (__driverlist)
    /opt/parallax/propeller-elf/lib/libc.a(init_io.o)
                                  /opt/parallax/propeller-elf/lib/libc.a(fopen_intern.o) (__InitIO)
    /opt/parallax/propeller-elf/lib/libc.a(thread.o)
                                  /opt/parallax/lib/gcc/propeller-elf/4.6.1/_crt0.o (__TLS)
    /opt/parallax/propeller-elf/lib/libc.a(memcpy.o)
                                  SPI_Demo.o (_memcpy)
    /opt/parallax/propeller-elf/lib/libc.a(memset.o)
                                  /opt/parallax/lib/gcc/propeller-elf/4.6.1/_crtbegin.o (_memset)
    /opt/parallax/propeller-elf/lib/libc.a(SimpleSerial.o)
                                  /opt/parallax/propeller-elf/lib/libc.a(default_io.o) (__SimpleSerialDriver)
    /opt/parallax/propeller-elf/lib/libc.a(serialparam.o)
                                  /opt/parallax/propeller-elf/lib/libc.a(SimpleSerial.o) (__baud)
    /opt/parallax/propeller-elf/lib/libc.a(terminal.o)
                                  /opt/parallax/propeller-elf/lib/libc.a(SimpleSerial.o) (__term_write)
    /opt/parallax/propeller-elf/lib/libc.a(fflush.o)
                                  /opt/parallax/propeller-elf/lib/libc.a(fopen_intern.o) (_fflush)
    /opt/parallax/propeller-elf/lib/libc.a(atoi.o)
                                  /opt/parallax/propeller-elf/lib/libc.a(SimpleSerial.o) (_atoi)
    /opt/parallax/propeller-elf/lib/libc.a(ctype.o)
                                  /opt/parallax/propeller-elf/lib/libc.a(atoi.o) (___ctype)
    
    
    Allocating common symbols
    Common symbol       size              file
    
    
    ___stdio_lock       0x4               /opt/parallax/propeller-elf/lib/libc.a(fopen_intern.o)
    _(float, int, long,...)(short)
                        0x1a0             /opt/parallax/propeller-elf/lib/libc.a(fopen_intern.o)
    
    
    Memory Configuration
    
    
    Name             Origin             Length             Attributes
    hub              0x00000000         0x00008000
    cog              0x00000000         0x000007c0
    coguser          0x00000000         0x000007c0
    ram              0x20000000         0x10000000
    rom              0x30000000         0x10000000
    drivers          0xc0000000         0x00100000
    dummy            0xe0000000         0x00100000
    *default*        0x00000000         0xffffffff
    
    
    Linker script and memory map
    
    
    LOAD /opt/parallax/lib/gcc/propeller-elf/4.6.1/spinboot.o
    LOAD /opt/parallax/lib/gcc/propeller-elf/4.6.1/_crt0.o
    LOAD /opt/parallax/lib/gcc/propeller-elf/4.6.1/_crtbegin.o
    LOAD SPI_Demo.o
    LOAD ../../../Debug/libPropWare.a
    LOAD /opt/parallax/lib/gcc/propeller-elf/4.6.1/libgcc.a
    START GROUP
    LOAD /opt/parallax/propeller-elf/lib/libc.a
    LOAD /opt/parallax/lib/gcc/propeller-elf/4.6.1/libgcc.a
    END GROUP
    LOAD /opt/parallax/lib/gcc/propeller-elf/4.6.1/libgcc.a
    LOAD /opt/parallax/lib/gcc/propeller-elf/4.6.1/_crtend.o
    
    
    .boot           0x00000000       0x20
     *(.boot)
     .boot          0x00000000       0x20 /opt/parallax/lib/gcc/propeller-elf/4.6.1/spinboot.o
                    0x00000000                __clkfreq
                    0x00000004                __clkmode
                    0x00000008                __sys_mbox
    
    
    .lmmkernel      0x00000000      0x794 load address 0x00000020
     *(.lmmkernel)
     .lmmkernel     0x00000000      0x790 /opt/parallax/lib/gcc/propeller-elf/4.6.1/_crt0.o
                    0x00000000                __LMM_entry
                    0x00000000                r0
                    0x00000004                r1
                    0x00000008                r2
                    0x0000000c                r3
                    0x00000010                r4
                    0x00000014                r5
                    0x00000018                r6
                    0x0000001c                r7
                    0x00000020                r8
                    0x00000024                r9
                    0x00000028                r10
                    0x0000002c                r11
                    0x00000030                r12
                    0x00000034                r13
                    0x00000038                r14
                    0x0000003c                lr
                    0x00000040                sp
                    0x00000044                pc
                    0x000000ac                __LMM_MVI_r0
                    0x000000b8                __LMM_MVI_r1
                    0x000000c4                __LMM_MVI_r2
                    0x000000d0                __LMM_MVI_r3
                    0x000000dc                __LMM_MVI_r4
                    0x000000e8                __LMM_MVI_r5
                    0x000000f4                __LMM_MVI_r6
                    0x00000100                __LMM_MVI_r7
                    0x0000010c                __LMM_MVI_r8
                    0x00000118                __LMM_MVI_r9
                    0x00000124                __LMM_MVI_r10
                    0x00000130                __LMM_MVI_r11
                    0x0000013c                __LMM_MVI_r12
                    0x00000148                __LMM_MVI_r13
                    0x00000154                __LMM_MVI_r14
                    0x00000160                __LMM_MVI_lr
                    0x0000016c                __LMM_CALL
                    0x00000174                __LMM_CALL_INDIRECT
                    0x00000180                __LMM_JMP
                    0x00000188                __LMM_PUSHM
                    0x000001a8                __LMM_PUSHM_ret
                    0x000001b0                __LMM_POPRET
                    0x000001b8                __LMM_POPRET_ret
                    0x000001bc                __LMM_POPM
                    0x000001dc                __LMM_POPM_ret
                    0x000001e0                __MASK_0000FFFF
                    0x000001e4                __MASK_FFFFFFFF
                    0x000001e8                __TMP0
                    0x000001fc                __CLZSI
                    0x00000200                __CTZSI
                    0x00000238                __CLZSI_ret
                    0x00000244                __UDIVSI
                    0x00000288                __UDIVSI_ret
                    0x00000290                __DIVSI
                    0x000002b8                __DIVSI_ret
                    0x000002c8                __MULSI
                    0x000002e8                __MULSI_ret
                    0x000002ec                __C_LOCK_PTR
                    0x000002f0                __CMPSWAPSI
                    0x00000310                __CMPSWAPSI_ret
                    0x0000031c                __LMM_RET
                    0x00000320                __LMM_FCACHE_LOAD
                    0x00000390                __LMM_FCACHE_START
     *(.kernel)
     .kernel        0x00000790        0x4 /opt/parallax/propeller-elf/lib/libc.a(thread.o)
                    0x00000790                __TLS
    
    
    .init           0x000007b4       0xb8
     *(.init*)
     .init          0x000007b4       0xa0 /opt/parallax/lib/gcc/propeller-elf/4.6.1/_crtbegin.o
                    0x000007b4                entry
                    0x000007b4                start
                    0x000007fc                ___init
     .init          0x00000854       0x18 /opt/parallax/lib/gcc/propeller-elf/4.6.1/_crtend.o
    
    
    .text           0x0000086c     0x1084
     *(.text*)
     .text          0x0000086c        0x0 /opt/parallax/lib/gcc/propeller-elf/4.6.1/spinboot.o
     .text          0x0000086c        0x0 /opt/parallax/lib/gcc/propeller-elf/4.6.1/_crt0.o
     .text          0x0000086c        0x0 /opt/parallax/lib/gcc/propeller-elf/4.6.1/_crtbegin.o
     .text          0x0000086c      0x15c SPI_Demo.o
                    0x0000086c                _main
     .text          0x000009c8      0x414 ../../../Debug/libPropWare.a(spi.o)
                    0x00000a26                _SPIStop
                    0x00000a48                _SPIIsRunning
                    0x00000a5c                _SPIWait
                    0x00000a8c                _SPIWaitSpecific
                    0x00000abf                _SPISetMode
                    0x00000af5                _SPISetBitMode
                    0x00000b31                _SPISetClock
                    0x00000b76                _SPIStart
                    0x00000c79                _SPIGetClock
                    0x00000cba                _SPIShiftOut
                    0x00000cf5                _SPIShiftIn
                    0x00000d48                _SPIShiftOut_fast
                    0x00000d68                _SPIShiftIn_fast
                    0x00000dbd                _SPIShiftIn_sector
     .text          0x00000ddc       0x6c ../../../Debug/libPropWare.a(PropWare.o)
                    0x00000ddc                _GPIOSwitchRead_Low
                    0x00000e1a                _PropWareCountBits
                    0x00000e2e                _PropWareGetPinNum
     .text          0x00000e48      0x100 /opt/parallax/propeller-elf/lib/libc.a(fputc.o)
                    0x00000e48                _fputc
     .text          0x00000f48      0x2f0 /opt/parallax/propeller-elf/lib/libc.a(fopen_intern.o)
                    0x00000f48                ___fopen_driver
                    0x00001118                _fclose
     .text          0x00001238        0x0 /opt/parallax/propeller-elf/lib/libc.a(default_io.o)
     .text          0x00001238       0xc8 /opt/parallax/propeller-elf/lib/libc.a(init_io.o)
                    0x00001238                __InitIO
     .text          0x00001300        0x4 /opt/parallax/propeller-elf/lib/libc.a(thread.o)
     .text          0x00001304       0x80 /opt/parallax/propeller-elf/lib/libc.a(memcpy.o)
                    0x00001304                _memcpy
     .text          0x00001384       0x9c /opt/parallax/propeller-elf/lib/libc.a(memset.o)
                    0x00001384                _memset
     .text          0x00001420      0x280 /opt/parallax/propeller-elf/lib/libc.a(SimpleSerial.o)
     .text          0x000016a0        0x0 /opt/parallax/propeller-elf/lib/libc.a(serialparam.o)
     .text          0x000016a0        0x0 /opt/parallax/propeller-elf/lib/libc.a(terminal.o)
     .text          0x000016a0      0x1ac /opt/parallax/propeller-elf/lib/libc.a(fflush.o)
                    0x000017f4                _fflush
     .text          0x0000184c       0xa4 /opt/parallax/propeller-elf/lib/libc.a(atoi.o)
                    0x0000184c                _atoi
                    0x0000184c                _atol
     .text          0x000018f0        0x0 /opt/parallax/propeller-elf/lib/libc.a(ctype.o)
     .text          0x000018f0        0x0 /opt/parallax/lib/gcc/propeller-elf/4.6.1/_crtend.o
                    0x000018f0                _etext = .
    
    
    .fini           0x000018f0       0x3c
     *(.fini*)
     .fini          0x000018f0       0x28 /opt/parallax/lib/gcc/propeller-elf/4.6.1/_crtbegin.o
                    0x000018f0                _exit
     .fini          0x00001918       0x14 /opt/parallax/lib/gcc/propeller-elf/4.6.1/_crtend.o
                    0x0000191c                __exit
                    0x0000191c                __Exit
                    0x00001928                __ExitHook
    
    
    .hub            0x0000192c      0x330
     *(.hubstart)
     *(.hubtext*)
     .hubtext       0x0000192c      0x23c /opt/parallax/propeller-elf/lib/libc.a(terminal.o)
                    0x0000192c                __term_write
                    0x000019b8                __term_read
     *(.hubdata*)
     *(.hub)
     *(.data)
     .data          0x00001b68        0x0 /opt/parallax/lib/gcc/propeller-elf/4.6.1/spinboot.o
     .data          0x00001b68        0x0 /opt/parallax/lib/gcc/propeller-elf/4.6.1/_crt0.o
     .data          0x00001b68        0x0 /opt/parallax/lib/gcc/propeller-elf/4.6.1/_crtbegin.o
     .data          0x00001b68       0x10 SPI_Demo.o
     .data          0x00001b78        0x8 ../../../Debug/libPropWare.a(spi.o)
     .data          0x00001b80        0x0 ../../../Debug/libPropWare.a(PropWare.o)
     .data          0x00001b80        0x0 /opt/parallax/propeller-elf/lib/libc.a(fputc.o)
     .data          0x00001b80        0x4 /opt/parallax/propeller-elf/lib/libc.a(fopen_intern.o)
                    0x00001b80                ___dummy
     .data          0x00001b84        0x8 /opt/parallax/propeller-elf/lib/libc.a(default_io.o)
                    0x00001b84                __driverlist
     .data          0x00001b8c        0xc /opt/parallax/propeller-elf/lib/libc.a(init_io.o)
     .data          0x00001b98        0x4 /opt/parallax/propeller-elf/lib/libc.a(thread.o)
                    0x00001b98                ___yield_ptr
     .data          0x00001b9c        0x0 /opt/parallax/propeller-elf/lib/libc.a(memcpy.o)
     .data          0x00001b9c        0x0 /opt/parallax/propeller-elf/lib/libc.a(memset.o)
     .data          0x00001b9c       0x2c /opt/parallax/propeller-elf/lib/libc.a(SimpleSerial.o)
                    0x00001b9c                __SimpleSerialDriver
                    0x00001bc0                __SimpleSerialPrefix
     .data          0x00001bc8        0xc /opt/parallax/propeller-elf/lib/libc.a(serialparam.o)
                    0x00001bc8                __baud
                    0x00001bcc                __txpin
                    0x00001bd0                __rxpin
     .data          0x00001bd4        0x0 /opt/parallax/propeller-elf/lib/libc.a(terminal.o)
     .data          0x00001bd4        0x0 /opt/parallax/propeller-elf/lib/libc.a(fflush.o)
     .data          0x00001bd4        0x0 /opt/parallax/propeller-elf/lib/libc.a(atoi.o)
     .data          0x00001bd4       0x84 /opt/parallax/propeller-elf/lib/libc.a(ctype.o)
                    0x00001bd4                ___ctype
     .data          0x00001c58        0x0 /opt/parallax/lib/gcc/propeller-elf/4.6.1/_crtend.o
     *(.data*)
     *(.rodata)
     *(.rodata*)
     *(.gnu.linkonce.d*)
                    0x00001c58                PROVIDE (__C_LOCK, .)
                    0x00001c58        0x4 LONG 0x0
    
    
    .ctors          0x00001c5c        0x8
     *(.ctors*)
     .ctors         0x00001c5c        0x4 /opt/parallax/propeller-elf/lib/libc.a(init_io.o)
     .ctors         0x00001c60        0x4 /opt/parallax/lib/gcc/propeller-elf/4.6.1/_crtend.o
                    0x00001c60                __environ
                    0x00001c60                __argv
    
    
    .dtors          0x00001c64        0xc
     *(.dtors*)
     .dtors         0x00001c64        0x4 /opt/parallax/propeller-elf/lib/libc.a(fopen_intern.o)
     .dtors         0x00001c68        0x4 /opt/parallax/propeller-elf/lib/libc.a(SimpleSerial.o)
     .dtors         0x00001c6c        0x4 /opt/parallax/lib/gcc/propeller-elf/4.6.1/_crtend.o
    
    
    .data           0x00001c70        0x0
                    0x00001c70                . = ALIGN (0x4)
    
    
    .bss            0x00001c70      0x29c
                    0x00001c70                PROVIDE (__bss_start, .)
     *(.bss)
     .bss           0x00001c70        0x0 /opt/parallax/lib/gcc/propeller-elf/4.6.1/spinboot.o
     .bss           0x00001c70        0x0 /opt/parallax/lib/gcc/propeller-elf/4.6.1/_crt0.o
     .bss           0x00001c70        0x0 /opt/parallax/lib/gcc/propeller-elf/4.6.1/_crtbegin.o
     .bss           0x00001c70        0x0 SPI_Demo.o
     .bss           0x00001c70        0x0 ../../../Debug/libPropWare.a(spi.o)
     .bss           0x00001c70        0x0 ../../../Debug/libPropWare.a(PropWare.o)
     .bss           0x00001c70        0x0 /opt/parallax/propeller-elf/lib/libc.a(fputc.o)
     .bss           0x00001c70        0x0 /opt/parallax/propeller-elf/lib/libc.a(fopen_intern.o)
     .bss           0x00001c70        0x0 /opt/parallax/propeller-elf/lib/libc.a(default_io.o)
     .bss           0x00001c70       0x50 /opt/parallax/propeller-elf/lib/libc.a(init_io.o)
     .bss           0x00001cc0       0xa8 /opt/parallax/propeller-elf/lib/libc.a(thread.o)
                    0x00001cc0                ___napuntil_ptr
     .bss           0x00001d68        0x0 /opt/parallax/propeller-elf/lib/libc.a(memcpy.o)
     .bss           0x00001d68        0x0 /opt/parallax/propeller-elf/lib/libc.a(memset.o)
     .bss           0x00001d68        0x0 /opt/parallax/propeller-elf/lib/libc.a(SimpleSerial.o)
     .bss           0x00001d68        0x0 /opt/parallax/propeller-elf/lib/libc.a(serialparam.o)
     .bss           0x00001d68        0x0 /opt/parallax/propeller-elf/lib/libc.a(terminal.o)
     .bss           0x00001d68        0x0 /opt/parallax/propeller-elf/lib/libc.a(fflush.o)
     .bss           0x00001d68        0x0 /opt/parallax/propeller-elf/lib/libc.a(atoi.o)
     .bss           0x00001d68        0x0 /opt/parallax/propeller-elf/lib/libc.a(ctype.o)
     .bss           0x00001d68        0x0 /opt/parallax/lib/gcc/propeller-elf/4.6.1/_crtend.o
     *(.bss*)
     *(COMMON)
     COMMON         0x00001d68      0x1a4 /opt/parallax/propeller-elf/lib/libc.a(fopen_intern.o)
                    0x00001d68                ___stdio_lock
                    0x00001d6c                ___files
                    0x00001f0c                PROVIDE (__bss_end, .)
    
    
    .hub_heap       0x00001f0c        0x4
                    0x00001f10                . = (. + 0x4)
     *fill*         0x00001f0c        0x4 00
                    0x00001f0c                ___hub_heap_start = ADDR (.hub_heap)
    
    
    .drivers
     *(.drivers)
                    0x00000020                __load_start_kernel = LOADADDR (.lmmkernel)
                    0x00001c5c                ___CTOR_LIST__ = ADDR (.ctors)
                    0x00001c64                ___DTOR_LIST__ = ADDR (.dtors)
    
    
    .hash
     *(.hash)
    
    
    .dynsym
     *(.dynsym)
    
    
    .dynstr
     *(.dynstr)
    
    
    .gnu.version
     *(.gnu.version)
    
    
    .gnu.version_d
     *(.gnu.version_d)
    
    
    .gnu.version_r
     *(.gnu.version_r)
    
    
    .rel.init
     *(.rel.init)
    
    
    .rela.init
     *(.rela.init)
    
    
    .rel.text
     *(.rel.text)
     *(.rel.text.*)
     *(.rel.gnu.linkonce.t*)
    
    
    .rela.text
     *(.rela.text)
     *(.rela.text.*)
     *(.rela.gnu.linkonce.t*)
    
    
    .rel.fini
     *(.rel.fini)
    
    
    .rela.fini
     *(.rela.fini)
    
    
    .rel.rodata
     *(.rel.rodata)
     *(.rel.rodata.*)
     *(.rel.gnu.linkonce.r*)
    
    
    .rela.rodata
     *(.rela.rodata)
     *(.rela.rodata.*)
     *(.rela.gnu.linkonce.r*)
    
    
    .rel.data
     *(.rel.data)
     *(.rel.data.*)
     *(.rel.gnu.linkonce.d*)
    
    
    .rela.data
     *(.rela.data)
     *(.rela.data.*)
     *(.rela.gnu.linkonce.d*)
    
    
    .rel.ctors
     *(.rel.ctors)
    
    
    .rela.ctors
     *(.rela.ctors)
    
    
    .rel.dtors
     *(.rel.dtors)
    
    
    .rela.dtors
     *(.rela.dtors)
    
    
    .rel.got
     *(.rel.got)
    
    
    .rela.got
     *(.rela.got)
    
    
    .rel.bss
     *(.rel.bss)
    
    
    .rela.bss
     *(.rela.bss)
    
    
    .rel.plt
     *(.rel.plt)
    
    
    .rela.plt
     *(.rela.plt)
    
    
    .stab
     *(.stab)
    
    
    .stabstr
     *(.stabstr)
    
    
    .stab.excl
     *(.stab.excl)
    
    
    .stab.exclstr
     *(.stab.exclstr)
    
    
    .stab.index
     *(.stab.index)
    
    
    .stab.indexstr
     *(.stab.indexstr)
    
    
    .comment
     *(.comment)
    
    
    .debug
     *(.debug)
    
    
    .line
     *(.line)
    
    
    .debug_srcinfo
     *(.debug_srcinfo .zdebug_srcinfo)
    
    
    .debug_sfnames
     *(.debug_sfnames .zdebug_sfnames)
    
    
    .debug_aranges
     *(.debug_aranges .zdebug_aranges)
    
    
    .debug_pubnames
     *(.debug_pubnames .zdebug_pubnames)
    
    
    .debug_info
     *(.debug_info .gnu.linkonce.wi.* .zdebug_info)
    
    
    .debug_abbrev
     *(.debug_abbrev .zdebug_abbrev)
    
    
    .debug_line
     *(.debug_line .zdebug_line)
    
    
    .debug_frame
     *(.debug_frame .zdebug_frame)
    
    
    .debug_str
     *(.debug_str .zdebug_str)
    
    
    .debug_loc
     *(.debug_loc .zdebug_loc)
    
    
    .debug_macinfo
     *(.debug_macinfo .zdebug_macinfo)
                    0x000007c0                PROVIDE (par, PAR)
                    0x000007c4                PROVIDE (cnt, CNT)
                    0x000007c8                PROVIDE (ina, INA)
                    0x000007cc                PROVIDE (inb, INB)
                    0x000007d0                PROVIDE (outa, OUTA)
                    0x000007d4                PROVIDE (outb, OUTB)
                    0x000007d8                PROVIDE (dira, DIRA)
                    0x000007dc                PROVIDE (dirb, DIRB)
                    0x000007e0                PROVIDE (ctra, CTRA)
                    0x000007e4                PROVIDE (ctrb, CTRB)
                    0x000007e8                PROVIDE (frqa, FRQA)
                    0x000007ec                PROVIDE (frqb, FRQB)
                    0x000007f0                PROVIDE (phsa, PHSA)
                    0x000007f4                PROVIDE (phsb, PHSB)
                    0x000007f8                PROVIDE (vcfg, VCFG)
                    0x000007fc                PROVIDE (vscl, VSCL)
                    0x00001f1c                PROVIDE (__hub_end, (ADDR (.hub_heap) + 0x10))
                    0x00008000                PROVIDE (__stack_end, 0x8000)
    OUTPUT(SPI_Demo.elf elf32-propeller)
    ../../../Debug/libPropWare.a(spi.o): In function `_SPIStart':
    (.text+0x21a): undefined reference to `__load_start_spi_as_cog'
    collect2: ld returned 1 exit status
    make: *** [SPI_Demo.elf] Error 1
    

    (I've pushed the changes to common.mk and spi_as.S)
  • DavidZemonDavidZemon Posts: 2,973
    edited 2013-12-04 08:25
    Still trying to find the memory map of the library file. I tried "propeller-elf-ld --print-map libPropWare.a" and came up with something that still doesn't look right at all.
    Memory Configuration
    
    Name             Origin             Length             Attributes
    hub              0x00000000         0x00008000
    cog              0x00000000         0x000007c0
    coguser          0x00000000         0x000007c0
    ram              0x20000000         0x10000000
    rom              0x30000000         0x10000000
    drivers          0xc0000000         0x00100000
    dummy            0xe0000000         0x00100000
    *default*        0x00000000         0xffffffff
    
    
    Linker script and memory map
    
    
    LOAD libPropWare.a
    
    
    .boot
     *(.boot)
    
    
    .lmmkernel      0x00000000        0x0
     *(.lmmkernel)
     *(.kernel)
    
    
    .init
     *(.init*)
    
    
    .text           0x00000000        0x0
     *(.text*)
                    0x00000000                _etext = .
    
    
    .fini
     *(.fini*)
    
    
    .hub            0x00000000        0x4
     *(.hubstart)
     *(.hubtext*)
     *(.hubdata*)
     *(.hub)
     *(.data)
     *(.data*)
     *(.rodata)
     *(.rodata*)
     *(.gnu.linkonce.d*)
                    0x00000000                PROVIDE (__C_LOCK, .)
                    0x00000000        0x4 LONG 0x0
    
    
    .ctors          0x00000004        0x0
     *(.ctors*)
    
    
    .dtors          0x00000004        0x0
     *(.dtors*)
    
    
    .data           0x00000004        0x0
                    0x00000004                . = ALIGN (0x4)
    
    
    .bss            0x00000004        0x0
                    0x00000004                PROVIDE (__bss_start, .)
     *(.bss)
     *(.bss*)
     *(COMMON)
                    0x00000004                PROVIDE (__bss_end, .)
    
    
    .hub_heap       0x00000004        0x4
                    0x00000008                . = (. + 0x4)
     *fill*         0x00000004        0x4 00
                    0x00000004                ___hub_heap_start = ADDR (.hub_heap)
    
    
    .drivers
     *(.drivers)
                    0x00000000                __load_start_kernel = LOADADDR (.lmmkernel)
                    0x00000004                ___CTOR_LIST__ = ADDR (.ctors)
                    0x00000004                ___DTOR_LIST__ = ADDR (.dtors)
    
    
    .hash
     *(.hash)
    
    
    .dynsym
     *(.dynsym)
    
    
    .dynstr
     *(.dynstr)
    
    
    .gnu.version
     *(.gnu.version)
    
    
    .gnu.version_d
     *(.gnu.version_d)
    
    
    .gnu.version_r
     *(.gnu.version_r)
    
    
    .rel.init
     *(.rel.init)
    
    
    .rela.init
     *(.rela.init)
    
    
    .rel.text
     *(.rel.text)
     *(.rel.text.*)
     *(.rel.gnu.linkonce.t*)
    
    
    .rela.text
     *(.rela.text)
     *(.rela.text.*)
     *(.rela.gnu.linkonce.t*)
    
    
    .rel.fini
     *(.rel.fini)
    
    
    .rela.fini
     *(.rela.fini)
    
    
    .rel.rodata
     *(.rel.rodata)
     *(.rel.rodata.*)
     *(.rel.gnu.linkonce.r*)
    
    
    .rela.rodata
     *(.rela.rodata)
     *(.rela.rodata.*)
     *(.rela.gnu.linkonce.r*)
    
    
    .rel.data
     *(.rel.data)
     *(.rel.data.*)
     *(.rel.gnu.linkonce.d*)
    
    
    .rela.data
     *(.rela.data)
     *(.rela.data.*)
     *(.rela.gnu.linkonce.d*)
    
    
    .rel.ctors
     *(.rel.ctors)
    
    
    .rela.ctors
     *(.rela.ctors)
    
    
    .rel.dtors
     *(.rel.dtors)
    
    
    .rela.dtors
     *(.rela.dtors)
    
    
    .rel.got
     *(.rel.got)
    
    
    .rela.got
     *(.rela.got)
    
    
    .rel.bss
     *(.rel.bss)
    
    
    .rela.bss
     *(.rela.bss)
    
    
    .rel.plt
     *(.rel.plt)
    
    
    .rela.plt
     *(.rela.plt)
    
    
    .stab
     *(.stab)
    
    
    .stabstr
     *(.stabstr)
    
    
    .stab.excl
     *(.stab.excl)
    
    
    .stab.exclstr
     *(.stab.exclstr)
    
    
    .stab.index
     *(.stab.index)
    
    
    .stab.indexstr
     *(.stab.indexstr)
    
    
    .comment
     *(.comment)
    
    
    .debug
     *(.debug)
    
    
    .line
     *(.line)
    
    
    .debug_srcinfo
     *(.debug_srcinfo .zdebug_srcinfo)
    
    
    .debug_sfnames
     *(.debug_sfnames .zdebug_sfnames)
    
    
    .debug_aranges
     *(.debug_aranges .zdebug_aranges)
    
    
    .debug_pubnames
     *(.debug_pubnames .zdebug_pubnames)
    
    
    .debug_info
     *(.debug_info .gnu.linkonce.wi.* .zdebug_info)
    
    
    .debug_abbrev
     *(.debug_abbrev .zdebug_abbrev)
    
    
    .debug_line
     *(.debug_line .zdebug_line)
    
    
    .debug_frame
     *(.debug_frame .zdebug_frame)
    
    
    .debug_str
     *(.debug_str .zdebug_str)
    
    
    .debug_loc
     *(.debug_loc .zdebug_loc)
    
    
    .debug_macinfo
     *(.debug_macinfo .zdebug_macinfo)
    built in linker script:193: undefined symbol `PAR' referenced in expression
    
  • DavidZemonDavidZemon Posts: 2,973
    edited 2013-12-04 09:00
    Finally got my map!
    spi_as.o:     file format elf32-propeller
    
    SYMBOL TABLE:
    00000000 l    d  .text    00000000 .text
    00000000 l    d  .data    00000000 .data
    00000000 l    d  .bss    00000000 .bss
    00000000 l    d  .spi_as_cog    00000000 .spi_as_cog
    000004a4 l       .spi_as_cog    00000000 testLEDs
    00000490 l       .spi_as_cog    00000000 negOne
    00000440 l       .spi_as_cog    00000000 READ_CMD
    00000450 l       .spi_as_cog    00000000 READ_CMD_ret
    

    I'm guessing that's where I *should* see "__load_start_spi_as_cog"?

    I've done some renaming and it didn't help any. Here's the new map:
    spi_as.o:     file format elf32-propeller
    
    
    SYMBOL TABLE:
    00000000 l    d  .text    00000000 .text
    00000000 l    d  .data    00000000 .data
    00000000 l    d  .bss    00000000 .bss
    00000000 l    d  _spi_as_cog    00000000 _spi_as_cog
    000004a4 l       _spi_as_cog    00000000 testLEDs
    00000490 l       _spi_as_cog    00000000 negOne
    00000440 l       _spi_as_cog    00000000 READ_CMD
    
    And yet, it still complains
    OUTPUT(SPI_Demo.elf elf32-propeller)
    ../../../Debug/libPropWare.a(spi.o): In function `_SPIStart':
    (.text+0x21a): undefined reference to `_spi_as_cog'
    collect2: ld returned 1 exit status
    make: *** [SPI_Demo.elf] Error 1
    
  • jazzedjazzed Posts: 11,803
    edited 2013-12-04 09:51
    I really struggled getting your code to build.

    To make it work, I had to do this:

    Change all #include <PropWare.h> and other local includes to use non-default library syntax as #include "PropWare.h"

    Add a main to your PropWare.c file.

    Change your make file to look like this:
    # Build all source code files within PropWare for easy testing of compilation errors
    
    
    BOARD = QUICKSTART
    MODEL = cmm
    CFLAGS = -Os
    
    
    NAME= PropWare
    OBJS= PropWare.o spi.o spi_as.o sd.o l3g.o mcp300x.o hd44780.o
    
    
    # Optionally, specify where your compiler is installed
    PREFIX = /c/propgcc
    
    
    all: $(NAME).elf
    
    
    include ./common.mk
    
    
    
    The make output looks like this:
    sh-3.1$ make clean
    rm -f *.o *.elf *.a *.cog *.ecog *.binary
    sh-3.1$ make
    /c/propgcc/bin/propeller-elf-gcc -Os -mcmm -Wall   -c -o PropWare.o PropWare.c
    /c/propgcc/bin/propeller-elf-gcc -Os -mcmm -Wall   -c -o spi.o spi.c
    spi.c: In function 'SPIStart':
    spi.c:37:16: warning: unused variable 'str' [-Wunused-variable]
    spi.c: In function 'SPISetMode':
    spi.c:126:10: warning: unused variable 'str' [-Wunused-variable]
    spi.c: In function 'SPISetBitMode':
    spi.c:146:10: warning: unused variable 'str' [-Wunused-variable]
    spi.c: In function 'SPISetClock':
    spi.c:165:10: warning: unused variable 'str' [-Wunused-variable]
    spi.c: In function 'SPIGetClock':
    spi.c:188:10: warning: unused variable 'str' [-Wunused-variable]
    spi.c: In function 'SPIShiftOut':
    spi.c:211:10: warning: unused variable 'str' [-Wunused-variable]
    spi.c: In function 'SPIShiftIn':
    spi.c:237:16: warning: unused variable 'str' [-Wunused-variable]
    spi.c: At top level:
    spi.h:268:16: warning: 'SPICountBits' declared 'static' but never defined [-Wunused-function]
    spi.h:281:16: warning: 'SPIGetPinNum' declared 'static' but never defined [-Wunused-function]
    /c/propgcc/bin/propeller-elf-gcc    -c -o spi_as.o spi_as.S
    /c/propgcc/bin/propeller-elf-gcc -Os -mcmm -Wall   -c -o sd.o sd.c
    sd.c: In function 'SDCreateFile':
    sd.c:1815:10: warning: unused variable 'uppercaseName' [-Wunused-variable]
    sd.c: At top level:
    spi.h:259:23: warning: 'SPIReadPar' declared 'static' but never defined [-Wunused-function]
    spi.h:268:16: warning: 'SPICountBits' declared 'static' but never defined [-Wunused-function]
    spi.h:281:16: warning: 'SPIGetPinNum' declared 'static' but never defined [-Wunused-function]
    /c/propgcc/bin/propeller-elf-gcc -Os -mcmm -Wall   -c -o l3g.o l3g.c
    spi.h:259:23: warning: 'SPIReadPar' declared 'static' but never defined [-Wunused-function]
    spi.h:268:16: warning: 'SPICountBits' declared 'static' but never defined [-Wunused-function]
    spi.h:281:16: warning: 'SPIGetPinNum' declared 'static' but never defined [-Wunused-function]
    l3g.c:140:9: warning: 'L3GWrite16' defined but not used [-Wunused-function]
    /c/propgcc/bin/propeller-elf-gcc -Os -mcmm -Wall   -c -o mcp300x.o mcp300x.c
    spi.h:259:23: warning: 'SPIReadPar' declared 'static' but never defined [-Wunused-function]
    spi.h:268:16: warning: 'SPICountBits' declared 'static' but never defined [-Wunused-function]
    spi.h:281:16: warning: 'SPIGetPinNum' declared 'static' but never defined [-Wunused-function]
    /c/propgcc/bin/propeller-elf-gcc -Os -mcmm -Wall   -c -o hd44780.o hd44780.c
    Building target: PropWare.elf
    Invoking: PropGCC Linker
    /c/propgcc/bin/propeller-elf-gcc -mcmm -fno-exceptions -L/c/propgcc/propeller-elf/lib/cmm  -o PropWare.elf PropWare.o sp
    i.o spi_as.o sd.o l3g.o mcp300x.o hd44780.o
    Finished building target: PropWare.elf
    
    
    sh-3.1$
    
    Finally I added this to common.mk to get a useful Map file:
    # #########################################################
    # Build Commands
    # #########################################################
    ifneq ($(NAME),)
    $(NAME).elf: $(OBJS)
            @echo 'Building target: $@'
            @echo 'Invoking: PropGCC Linker'
            $(CC) $(LDFLAGS) $(LIB_INC) $(LIBS) -o $@ $(OBJS)
            $(CC) -Xlinker -Map=$(NAME).map $(LDFLAGS) $(LIB_INC) $(LIBS) -o $@ $(OBJS)
            @echo 'Finished building target: $@'
            @echo ' '
    endif
    
    sh-3.1$ cat PropWare.map
    Archive member included because of file (symbol)
    
    
    c:/propgcc/propeller-elf/lib/cmm\libc.a(fputc.o)
                                  sd.o (_fputc)
    c:/propgcc/propeller-elf/lib/cmm\libc.a(puts.o)
                                  sd.o (_puts)
    c:/propgcc/propeller-elf/lib/cmm\libc.a(gets.o)
                                  sd.o (_gets)
    c:/propgcc/propeller-elf/lib/cmm\libc.a(fopen_intern.o)
                                  sd.o (_(float, int, long,...)(short))
    c:/propgcc/propeller-elf/lib/cmm\libc.a(printf.o)
                                  sd.o (_printf)
    c:/propgcc/propeller-elf/lib/cmm\libc.a(default_io.o)
                                  c:/propgcc/propeller-elf/lib/cmm\libc.a(fopen_intern.o) (__driverlist)
    c:/propgcc/propeller-elf/lib/cmm\libc.a(init_io.o)
                                  c:/propgcc/propeller-elf/lib/cmm\libc.a(fopen_intern.o) (__InitIO)
    c:/propgcc/propeller-elf/lib/cmm\libc.a(thread.o)
                                  c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/_crt0.o (__TLS)
    c:/propgcc/propeller-elf/lib/cmm\libc.a(memset.o)
                                  c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/_crtbegin.o (_memset)
    c:/propgcc/propeller-elf/lib/cmm\libc.a(strcmp.o)
                                  sd.o (_strcmp)
    c:/propgcc/propeller-elf/lib/cmm\libc.a(SimpleSerial.o)
                                  c:/propgcc/propeller-elf/lib/cmm\libc.a(default_io.o) (__SimpleSerialDriver)
    c:/propgcc/propeller-elf/lib/cmm\libc.a(serialparam.o)
                                  c:/propgcc/propeller-elf/lib/cmm\libc.a(SimpleSerial.o) (__baud)
    c:/propgcc/propeller-elf/lib/cmm\libc.a(terminal.o)
                                  c:/propgcc/propeller-elf/lib/cmm\libc.a(SimpleSerial.o) (__term_write)
    c:/propgcc/propeller-elf/lib/cmm\libc.a(fflush.o)
                                  c:/propgcc/propeller-elf/lib/cmm\libc.a(fopen_intern.o) (_fflush)
    c:/propgcc/propeller-elf/lib/cmm\libc.a(fgetc.o)
                                  c:/propgcc/propeller-elf/lib/cmm\libc.a(gets.o) (_fgetc)
    c:/propgcc/propeller-elf/lib/cmm\libc.a(fputs.o)
                                  c:/propgcc/propeller-elf/lib/cmm\libc.a(puts.o) (___do_fputs)
    c:/propgcc/propeller-elf/lib/cmm\libc.a(vfprintf.o)
                                  c:/propgcc/propeller-elf/lib/cmm\libc.a(printf.o) (_vfprintf)
    c:/propgcc/propeller-elf/lib/cmm\libc.a(atoi.o)
                                  c:/propgcc/propeller-elf/lib/cmm\libc.a(SimpleSerial.o) (_atoi)
    c:/propgcc/propeller-elf/lib/cmm\libc.a(ctype.o)
                                  c:/propgcc/propeller-elf/lib/cmm\libc.a(atoi.o) (___ctype)
    c:/propgcc/propeller-elf/lib/cmm\libc.a(wcrtomb_ascii.o)
                                  c:/propgcc/propeller-elf/lib/cmm\libc.a(vfprintf.o) (__wcrtomb_ptr)
    c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_udivdi3.o)
                                  c:/propgcc/propeller-elf/lib/cmm\libc.a(vfprintf.o) (___udivdi3)
    c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_umoddi3.o)
                                  c:/propgcc/propeller-elf/lib/cmm\libc.a(vfprintf.o) (___umoddi3)
    c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_clz.o)
                                  c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_udivdi3.o) (___clz_tab)
    
    
    Allocating common symbols
    Common symbol       size              file
    
    
    ___stdio_lock       0x4               c:/propgcc/propeller-elf/lib/cmm\libc.a(fopen_intern.o)
    _g_mcp300x_cs       0x1               mcp300x.o
    _g_l3g_cs           0x4               l3g.o
    _(float, int, long,...)(short)
                        0x1a0             c:/propgcc/propeller-elf/lib/cmm\libc.a(fopen_intern.o)
    _g_sd_buf           0x218             sd.o
    
    
    Memory Configuration
    
    
    Name             Origin             Length             Attributes
    hub              0x00000000         0x00008000
    cog              0x00000000         0x000007c0
    coguser          0x00000000         0x000007c0
    ram              0x20000000         0x10000000
    rom              0x30000000         0x10000000
    drivers          0xc0000000         0x00100000
    dummy            0xe0000000         0x00100000
    *default*        0x00000000         0xffffffff
    
    
    Linker script and memory map
    
    
    LOAD c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/spinboot.o
    LOAD c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/_crt0.o
    LOAD c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/_crtbegin.o
    LOAD PropWare.o
    LOAD spi.o
    LOAD spi_as.o
    LOAD sd.o
    LOAD l3g.o
    LOAD mcp300x.o
    LOAD hd44780.o
    LOAD c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a
    START GROUP
    LOAD c:/propgcc/propeller-elf/lib/cmm\libc.a
    LOAD c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a
    END GROUP
    LOAD c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a
    LOAD c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/_crtend.o
    
    
    .boot           0x00000000       0x20
     *(.boot)
     .boot          0x00000000       0x20 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/spinboot.o
                    0x00000000                __clkfreq
                    0x00000004                __clkmode
                    0x00000008                __sys_mbox
    
    
    .lmmkernel      0x00000000      0x764 load address 0x00000020
     *(.lmmkernel)
     .lmmkernel     0x00000000      0x760 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/_crt0.o
                    0x00000000                r0
                    0x00000000                __LMM_entry
                    0x00000004                r1
                    0x00000008                r2
                    0x0000000c                r3
                    0x00000010                r4
                    0x00000014                r5
                    0x00000018                r6
                    0x0000001c                r7
                    0x00000020                r8
                    0x00000024                r9
                    0x00000028                r10
                    0x0000002c                r11
                    0x00000030                r12
                    0x00000034                r13
                    0x00000038                r14
                    0x0000003c                lr
                    0x00000040                sp
                    0x00000044                pc
                    0x00000048                __MASK_FFFFFFFF
                    0x0000004c                __TMP0
                    0x00000440                __LMM_CALL
                    0x00000448                __LMM_CALL_INDIRECT
                    0x00000454                __LMM_JMP
                    0x00000460                __LMM_PUSHM
                    0x00000480                __LMM_PUSHM_ret
                    0x00000488                __LMM_POPRET
                    0x00000490                __LMM_POPRET_ret
                    0x00000494                __LMM_POPM
                    0x000004b4                __LMM_POPM_ret
                    0x000004b8                __MASK_0000FFFF
                    0x000004cc                __CLZSI
                    0x000004d0                __CTZSI
                    0x00000508                __CLZSI_ret
                    0x00000514                __UDIVSI
                    0x00000558                __UDIVSI_ret
                    0x00000560                __DIVSI
                    0x00000588                __DIVSI_ret
                    0x00000598                __MULSI
                    0x000005b8                __MULSI_ret
                    0x000005bc                __C_LOCK_PTR
                    0x000005c0                __CMPSWAPSI
                    0x000005e0                __CMPSWAPSI_ret
                    0x000005ec                __LMM_RET
                    0x00000660                __LMM_FCACHE_START
     *(.kernel)
     .kernel        0x00000760        0x4 c:/propgcc/propeller-elf/lib/cmm\libc.a(thread.o)
                    0x00000760                __TLS
    
    
    .init           0x00000784       0x74
     *(.init*)
     .init          0x00000784       0x60 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/_crtbegin.o
                    0x00000784                start
                    0x00000784                entry
                    0x000007ab                ___init
     .init          0x000007e4       0x14 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/_crtend.o
    
    
    .text           0x000007f8     0x3d78
     *(.text*)
     .text          0x000007f8        0x0 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/spinboot.o
     .text          0x000007f8        0x0 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/_crt0.o
     .text          0x000007f8        0x0 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/_crtbegin.o
     .text          0x000007f8       0x6c PropWare.o
                    0x000007f8                _GPIOSwitchRead_Low
                    0x00000836                _PropWareCountBits
                    0x0000084a                _PropWareGetPinNum
                    0x00000862                _main
     .text          0x00000864      0x414 spi.o
                    0x000008c2                _SPIStop
                    0x000008e4                _SPIIsRunning
                    0x000008f8                _SPIWait
                    0x00000928                _SPIWaitSpecific
                    0x0000095b                _SPISetMode
                    0x00000991                _SPISetBitMode
                    0x000009cd                _SPISetClock
                    0x00000a12                _SPIStart
                    0x00000b15                _SPIGetClock
                    0x00000b56                _SPIShiftOut
                    0x00000b91                _SPIShiftIn
                    0x00000be4                _SPIShiftOut_fast
                    0x00000c04                _SPIShiftIn_fast
                    0x00000c59                _SPIShiftIn_sector
     .text          0x00000c78        0x0 spi_as.o
     .text          0x00000c78     0x1850 sd.o
                    0x00000c78                _SDfeof
                    0x00000c8b                _SDfseekr
                    0x00000cbd                _SDfseekw
                    0x00000cef                _SDftellr
                    0x00000cf4                _SDftellw
                    0x00000cf9                _SDSendCommand
                    0x00000d33                _SDGetResponse
                    0x00000dab                _SDStart
                    0x00000f68                _SDReadBlock
                    0x0000105b                _SDWriteBlock
                    0x0000111a                _SDReadDataBlock
                    0x00001175                _SDWriteDataBlock
                    0x000011d0                _SDUnmount
                    0x00001228                _SDReadDat16
                    0x0000123a                _SDReadDat32
                    0x0000125d                _SDWriteDat16
                    0x00001269                _SDWriteDat32
                    0x00001285                _SDfclose
                    0x00001335                _SDGetSectorFromPath
                    0x0000133b                _SDGetSectorFromAlloc
                    0x0000135d                _SDGetFATValue
                    0x0000141e                _SDMount
                    0x000015e9                _SDLoadSectorFromOffset
                    0x000016f7                _SDIncCluster
                    0x0000176c                _SDLoadNextSector
                    0x00001808                _SDGetFilename
                    0x0000186b                _SDFind
                    0x00001959                _SDchdir
                    0x00001a3d                _SDReloadBuf
                    0x00001abf                _SDfgetc
                    0x00001b05                _SDfgets
                    0x00001b3a                _SDFindEmptySpace
                    0x00001ccd                _SDExtendFAT
                    0x00001da0                _SDfputc
                    0x00001e3f                _SDfputs
                    0x00001e5d                _SDCreateFile
                    0x00001f7f                _SD_Shell_touch
                    0x00001fab                _SDfopen
                    0x00002158                _SD_Shell_cat
                    0x00002191                _SDPrintFileAttributes
                    0x0000220d                _SDPrintFileEntry
                    0x00002250                _SD_Shell_ls
                    0x000022f1                _SD_Shell
     .text          0x000024c8      0x300 l3g.o
                    0x00002604                _L3GStart
                    0x00002677                _L3GAlwaysSetMode
                    0x0000267d                _L3GReadX
                    0x00002688                _L3GReadY
                    0x00002693                _L3GReadZ
                    0x0000269e                _L3GRead
                    0x000026ad                _L3GReadAll
                    0x00002755                _L3G_ioctl
     .text          0x000027c8      0x164 mcp300x.o
                    0x000027c8                _MCP300xStart
                    0x00002827                _MCP300xAlwaysSetMode
                    0x0000282d                _MCP300xRead
                    0x000028ac                _MCP300xReadDif
     .text          0x0000292c      0x658 hd44780.o
                    0x000029d7                _HD44780Clear
                    0x00002a04                _HD44780Start
                    0x00002cdc                _HD44780Move
                    0x00002d4a                _HD44780_putchar
                    0x00002dd8                _HD44780_puts
                    0x00002deb                _HD44780_int
                    0x00002e5e                _HD44780_uint
                    0x00002eb0                _HD44780_hex
                    0x00002ef6                _HD44780_printf
     .text          0x00002f84       0x80 c:/propgcc/propeller-elf/lib/cmm\libc.a(fputc.o)
                    0x00002f84                _fputc
     .text          0x00003004        0xc c:/propgcc/propeller-elf/lib/cmm\libc.a(puts.o)
                    0x00003004                _puts
     .text          0x00003010       0x34 c:/propgcc/propeller-elf/lib/cmm\libc.a(gets.o)
                    0x00003010                _gets
     .text          0x00003044      0x17c c:/propgcc/propeller-elf/lib/cmm\libc.a(fopen_intern.o)
                    0x00003044                ___fopen_driver
                    0x00003131                _fclose
     .text          0x000031c0       0x10 c:/propgcc/propeller-elf/lib/cmm\libc.a(printf.o)
                    0x000031c0                _printf
     .text          0x000031d0        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(default_io.o)
     .text          0x000031d0       0x50 c:/propgcc/propeller-elf/lib/cmm\libc.a(init_io.o)
                    0x000031d0                __InitIO
     .text          0x00003220        0x4 c:/propgcc/propeller-elf/lib/cmm\libc.a(thread.o)
     .text          0x00003224       0x9c c:/propgcc/propeller-elf/lib/cmm\libc.a(memset.o)
                    0x00003224                _memset
     .text          0x000032c0       0x68 c:/propgcc/propeller-elf/lib/cmm\libc.a(strcmp.o)
                    0x000032c0                _strcmp
     .text          0x00003328      0x1dc c:/propgcc/propeller-elf/lib/cmm\libc.a(SimpleSerial.o)
     .text          0x00003504        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(serialparam.o)
     .text          0x00003504        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(terminal.o)
     .text          0x00003504       0xe0 c:/propgcc/propeller-elf/lib/cmm\libc.a(fflush.o)
                    0x000035bf                _fflush
     .text          0x000035e4       0xbc c:/propgcc/propeller-elf/lib/cmm\libc.a(fgetc.o)
                    0x000035e4                __filbuf
                    0x00003680                _fgetc
     .text          0x000036a0       0x60 c:/propgcc/propeller-elf/lib/cmm\libc.a(fputs.o)
                    0x000036a0                ___do_fputs
                    0x000036f7                _fputs
     .text          0x00003700      0x7d0 c:/propgcc/propeller-elf/lib/cmm\libc.a(vfprintf.o)
                    0x00003a70                _vfprintf
     .text          0x00003ed0       0x50 c:/propgcc/propeller-elf/lib/cmm\libc.a(atoi.o)
                    0x00003ed0                _atol
                    0x00003ed0                _atoi
     .text          0x00003f20        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(ctype.o)
     .text          0x00003f20       0x18 c:/propgcc/propeller-elf/lib/cmm\libc.a(wcrtomb_ascii.o)
                    0x00003f20                __wcrtomb_ascii
     .text          0x00003f38      0x338 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_udivdi3.o)
                    0x00003f38                ___udivdi3
     .text          0x00004270      0x300 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_umoddi3.o)
                    0x00004270                ___umoddi3
     .text          0x00004570        0x0 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_clz.o)
     .text          0x00004570        0x0 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/_crtend.o
                    0x00004570                _etext = .
    
    
    spi_as.cog      0x00000000      0x508 load address 0x00004570
     spi_as.cog     0x00000000      0x508 spi_as.o
    
    
    .fini           0x00004a78       0x30
     *(.fini*)
     .fini          0x00004a78       0x1c c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/_crtbegin.o
                    0x00004a78                _exit
     .fini          0x00004a94       0x14 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/_crtend.o
                    0x00004a96                __Exit
                    0x00004a96                __exit
                    0x00004aa2                __ExitHook
    
    
    .hub            0x00004aa8      0x488
     *(.hubstart)
     *(.hubtext*)
     .hubtext       0x00004aa8      0x134 c:/propgcc/propeller-elf/lib/cmm\libc.a(terminal.o)
                    0x00004aa8                __term_write
                    0x00004af4                __term_read
     *(.hubdata*)
     *(.hub)
     *(.data)
     .data          0x00004bdc        0x0 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/spinboot.o
     .data          0x00004bdc        0x0 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/_crt0.o
     .data          0x00004bdc        0x0 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/_crtbegin.o
     .data          0x00004bdc        0x0 PropWare.o
     .data          0x00004bdc        0x8 spi.o
     .data          0x00004be4        0x0 spi_as.o
     .data          0x00004be4      0x118 sd.o
     .data          0x00004cfc        0x0 l3g.o
     .data          0x00004cfc        0x0 mcp300x.o
     .data          0x00004cfc        0x0 hd44780.o
     .data          0x00004cfc        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(fputc.o)
     .data          0x00004cfc        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(puts.o)
     .data          0x00004cfc        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(gets.o)
     .data          0x00004cfc        0x4 c:/propgcc/propeller-elf/lib/cmm\libc.a(fopen_intern.o)
                    0x00004cfc                ___dummy
     .data          0x00004d00        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(printf.o)
     .data          0x00004d00        0x8 c:/propgcc/propeller-elf/lib/cmm\libc.a(default_io.o)
                    0x00004d00                __driverlist
     .data          0x00004d08        0xc c:/propgcc/propeller-elf/lib/cmm\libc.a(init_io.o)
     .data          0x00004d14        0x4 c:/propgcc/propeller-elf/lib/cmm\libc.a(thread.o)
                    0x00004d14                ___yield_ptr
     .data          0x00004d18        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(memset.o)
     .data          0x00004d18        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(strcmp.o)
     .data          0x00004d18       0x2c c:/propgcc/propeller-elf/lib/cmm\libc.a(SimpleSerial.o)
                    0x00004d18                __SimpleSerialDriver
                    0x00004d3c                __SimpleSerialPrefix
     .data          0x00004d44        0xc c:/propgcc/propeller-elf/lib/cmm\libc.a(serialparam.o)
                    0x00004d44                __baud
                    0x00004d48                __txpin
                    0x00004d4c                __rxpin
     .data          0x00004d50        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(terminal.o)
     .data          0x00004d50        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(fflush.o)
     .data          0x00004d50        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(fgetc.o)
     .data          0x00004d50        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(fputs.o)
     .data          0x00004d50       0x54 c:/propgcc/propeller-elf/lib/cmm\libc.a(vfprintf.o)
     .data          0x00004da4        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(atoi.o)
     .data          0x00004da4       0x84 c:/propgcc/propeller-elf/lib/cmm\libc.a(ctype.o)
                    0x00004da4                ___ctype
     .data          0x00004e28        0x4 c:/propgcc/propeller-elf/lib/cmm\libc.a(wcrtomb_ascii.o)
                    0x00004e28                __wcrtomb_ptr
     .data          0x00004e2c        0x0 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_udivdi3.o)
     .data          0x00004e2c        0x0 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_umoddi3.o)
     .data          0x00004e2c      0x100 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_clz.o)
                    0x00004e2c                ___clz_tab
     .data          0x00004f2c        0x0 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/_crtend.o
     *(.data*)
     *(.rodata)
     *(.rodata*)
     *(.gnu.linkonce.d*)
                    0x00004f2c                PROVIDE (__C_LOCK, .)
                    0x00004f2c        0x4 LONG 0x0
    
    
    .ctors          0x00004f30        0x8
     *(.ctors*)
     .ctors         0x00004f30        0x4 c:/propgcc/propeller-elf/lib/cmm\libc.a(init_io.o)
     .ctors         0x00004f34        0x4 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/_crtend.o
                    0x00004f34                __argv
                    0x00004f34                __environ
    
    
    .dtors          0x00004f38        0xc
     *(.dtors*)
     .dtors         0x00004f38        0x4 c:/propgcc/propeller-elf/lib/cmm\libc.a(fopen_intern.o)
     .dtors         0x00004f3c        0x4 c:/propgcc/propeller-elf/lib/cmm\libc.a(SimpleSerial.o)
     .dtors         0x00004f40        0x4 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/_crtend.o
    
    
    .data           0x00004f44        0x0
                    0x00004f44                . = ALIGN (0x4)
    
    
    .bss            0x00004f44      0x718
                    0x00004f44                PROVIDE (__bss_start, .)
     *(.bss)
     .bss           0x00004f44        0x0 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/spinboot.o
     .bss           0x00004f44        0x0 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/_crt0.o
     .bss           0x00004f44        0x0 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/_crtbegin.o
     .bss           0x00004f44        0x0 PropWare.o
     .bss           0x00004f44        0x0 spi.o
     .bss           0x00004f44        0x0 spi_as.o
     .bss           0x00004f44      0x230 sd.o
     .bss           0x00005174        0x4 l3g.o
                    0x00005174                _g_l3g_alwaysSetMode
     .bss           0x00005178        0x4 mcp300x.o
                    0x00005178                _g_mcp300x_alwaysSetMode
     .bss           0x0000517c       0x24 hd44780.o
     .bss           0x000051a0        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(fputc.o)
     .bss           0x000051a0        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(puts.o)
     .bss           0x000051a0        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(gets.o)
     .bss           0x000051a0        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(fopen_intern.o)
     .bss           0x000051a0        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(printf.o)
     .bss           0x000051a0        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(default_io.o)
     .bss           0x000051a0       0x50 c:/propgcc/propeller-elf/lib/cmm\libc.a(init_io.o)
     .bss           0x000051f0       0xa8 c:/propgcc/propeller-elf/lib/cmm\libc.a(thread.o)
                    0x000051f0                ___napuntil_ptr
     .bss           0x00005298        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(memset.o)
     .bss           0x00005298        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(strcmp.o)
     .bss           0x00005298        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(SimpleSerial.o)
     .bss           0x00005298        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(serialparam.o)
     .bss           0x00005298        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(terminal.o)
     .bss           0x00005298        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(fflush.o)
     .bss           0x00005298        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(fgetc.o)
     .bss           0x00005298        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(fputs.o)
     .bss           0x00005298        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(vfprintf.o)
     .bss           0x00005298        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(atoi.o)
     .bss           0x00005298        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(ctype.o)
     .bss           0x00005298        0x0 c:/propgcc/propeller-elf/lib/cmm\libc.a(wcrtomb_ascii.o)
     .bss           0x00005298        0x0 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_udivdi3.o)
     .bss           0x00005298        0x0 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_umoddi3.o)
     .bss           0x00005298        0x0 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_clz.o)
     .bss           0x00005298        0x0 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm/_crtend.o
     *(.bss*)
     *(COMMON)
     COMMON         0x00005298      0x218 sd.o
                    0x00005298                _g_sd_buf
     COMMON         0x000054b0        0x4 l3g.o
                    0x000054b0                _g_l3g_cs
     COMMON         0x000054b4        0x1 mcp300x.o
                    0x000054b4                _g_mcp300x_cs
     *fill*         0x000054b5        0x3 00
     COMMON         0x000054b8      0x1a4 c:/propgcc/propeller-elf/lib/cmm\libc.a(fopen_intern.o)
                    0x000054b8                ___stdio_lock
                    0x000054bc                _(float, int, long,...)(short)
                    0x0000565c                PROVIDE (__bss_end, .)
    
    
    .hub_heap       0x0000565c        0x4
                    0x00005660                . = (. + 0x4)
     *fill*         0x0000565c        0x4 00
                    0x0000565c                ___hub_heap_start = ADDR (.hub_heap)
    
    
    .drivers
     *(.drivers)
                    0x00000020                __load_start_kernel = LOADADDR (.lmmkernel)
                    0x00004f30                ___CTOR_LIST__ = ADDR (.ctors)
                    0x00004f38                ___DTOR_LIST__ = ADDR (.dtors)
    
    
    .hash
     *(.hash)
    
    
    .dynsym
     *(.dynsym)
    
    
    .dynstr
     *(.dynstr)
    
    
    .gnu.version
     *(.gnu.version)
    
    
    .gnu.version_d
     *(.gnu.version_d)
    
    
    .gnu.version_r
     *(.gnu.version_r)
    
    
    .rel.init
     *(.rel.init)
    
    
    .rela.init
     *(.rela.init)
    
    
    .rel.text
     *(.rel.text)
     *(.rel.text.*)
     *(.rel.gnu.linkonce.t*)
    
    
    .rela.text
     *(.rela.text)
     *(.rela.text.*)
     *(.rela.gnu.linkonce.t*)
    
    
    .rel.fini
     *(.rel.fini)
    
    
    .rela.fini
     *(.rela.fini)
    
    
    .rel.rodata
     *(.rel.rodata)
     *(.rel.rodata.*)
     *(.rel.gnu.linkonce.r*)
    
    
    .rela.rodata
     *(.rela.rodata)
     *(.rela.rodata.*)
     *(.rela.gnu.linkonce.r*)
    
    
    .rel.data
     *(.rel.data)
     *(.rel.data.*)
     *(.rel.gnu.linkonce.d*)
    
    
    .rela.data
     *(.rela.data)
     *(.rela.data.*)
     *(.rela.gnu.linkonce.d*)
    
    
    .rel.ctors
     *(.rel.ctors)
    
    
    .rela.ctors
     *(.rela.ctors)
    
    
    .rel.dtors
     *(.rel.dtors)
    
    
    .rela.dtors
     *(.rela.dtors)
    
    
    .rel.got
     *(.rel.got)
    
    
    .rela.got
     *(.rela.got)
    
    
    .rel.bss
     *(.rel.bss)
    
    
    .rela.bss
     *(.rela.bss)
    
    
    .rel.plt
     *(.rel.plt)
    
    
    .rela.plt
     *(.rela.plt)
    
    
    .stab
     *(.stab)
    
    
    .stabstr
     *(.stabstr)
    
    
    .stab.excl
     *(.stab.excl)
    
    
    .stab.exclstr
     *(.stab.exclstr)
    
    
    .stab.index
     *(.stab.index)
    
    
    .stab.indexstr
     *(.stab.indexstr)
    
    
    .comment
     *(.comment)
    
    
    .debug
     *(.debug)
    
    
    .line
     *(.line)
    
    
    .debug_srcinfo
     *(.debug_srcinfo .zdebug_srcinfo)
    
    
    .debug_sfnames
     *(.debug_sfnames .zdebug_sfnames)
    
    
    .debug_aranges  0x00000000       0x40
     *(.debug_aranges .zdebug_aranges)
     .debug_aranges
                    0x00000000       0x20 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_udivdi3.o)
     .debug_aranges
                    0x00000020       0x20 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_umoddi3.o)
    
    
    .debug_pubnames
     *(.debug_pubnames .zdebug_pubnames)
    
    
    .debug_info     0x00000000     0x127b
     *(.debug_info .gnu.linkonce.wi.* .zdebug_info)
     .debug_info    0x00000000      0x850 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_udivdi3.o)
     .debug_info    0x00000850      0x8ad c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_umoddi3.o)
     .debug_info    0x000010fd      0x17e c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_clz.o)
    
    
    .debug_abbrev   0x00000000      0x332
     *(.debug_abbrev .zdebug_abbrev)
     .debug_abbrev  0x00000000      0x162 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_udivdi3.o)
     .debug_abbrev  0x00000162      0x17a c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_umoddi3.o)
     .debug_abbrev  0x000002dc       0x56 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_clz.o)
    
    
    .debug_line     0x00000000      0x232
     *(.debug_line .zdebug_line)
     .debug_line    0x00000000       0xeb c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_udivdi3.o)
     .debug_line    0x000000eb       0xe7 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_umoddi3.o)
     .debug_line    0x000001d2       0x60 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_clz.o)
    
    
    .debug_frame    0x00000000       0x64
     *(.debug_frame .zdebug_frame)
     .debug_frame   0x00000000       0x30 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_udivdi3.o)
     .debug_frame   0x00000030       0x34 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_umoddi3.o)
    
    
    .debug_str      0x00000000       0x14
     *(.debug_str .zdebug_str)
     .debug_str     0x00000000        0xa c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_udivdi3.o)
     .debug_str     0x0000000a        0xa c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_umoddi3.o)
    
    
    .debug_loc      0x00000000     0x15b0
     *(.debug_loc .zdebug_loc)
     .debug_loc     0x00000000      0xb40 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_udivdi3.o)
     .debug_loc     0x00000b40      0xa70 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_umoddi3.o)
    
    
    .debug_macinfo
     *(.debug_macinfo .zdebug_macinfo)
                    0x000007c0                PROVIDE (par, PAR)
                    0x000007c4                PROVIDE (cnt, CNT)
                    0x000007c8                PROVIDE (ina, INA)
                    0x000007cc                PROVIDE (inb, INB)
                    0x000007d0                PROVIDE (outa, OUTA)
                    0x000007d4                PROVIDE (outb, OUTB)
                    0x000007d8                PROVIDE (dira, DIRA)
                    0x000007dc                PROVIDE (dirb, DIRB)
                    0x000007e0                PROVIDE (ctra, CTRA)
                    0x000007e4                PROVIDE (ctrb, CTRB)
                    0x000007e8                PROVIDE (frqa, FRQA)
                    0x000007ec                PROVIDE (frqb, FRQB)
                    0x000007f0                PROVIDE (phsa, PHSA)
                    0x000007f4                PROVIDE (phsb, PHSB)
                    0x000007f8                PROVIDE (vcfg, VCFG)
                    0x000007fc                PROVIDE (vscl, VSCL)
                    0x0000566c                PROVIDE (__hub_end, (ADDR (.hub_heap) + 0x10))
                    0x00008000                PROVIDE (__stack_end, 0x8000)
    OUTPUT(PropWare.elf elf32-propeller)
                    0x00004570                PROVIDE (__load_start_spi_as_cog, LOADADDR (spi_as.cog))
                    0x00004a78                PROVIDE (__load_stop_spi_as_cog, (LOADADDR (spi_as.cog) + SIZEOF (spi_as.cog))
    )
    
    
    .debug_ranges   0x00000000      0x178
     .debug_ranges  0x00000000       0xc8 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_udivdi3.o)
     .debug_ranges  0x000000c8       0xb0 c:/propgcc/bin/../lib/gcc/propeller-elf/4.6.1/cmm\libgcc.a(_umoddi3.o)
    sh-3.1$
    
    
    
    Here's a diff
    $ git diff
    diff --git a/Makefile b/Makefile
    index 9984c1a..7c68199 100644
    --- a/Makefile
    +++ b/Makefile
    @@ -1,15 +1,17 @@
     # Build all source code files within PropWare for easy testing of compilation e
    -PRJ = PropWare
    
    
    -all: PropWare.o spi.o spi_as.o sd.o l3g.o mcp300x.o hd44780.o
     BOARD = QUICKSTART
     MODEL = cmm
     CFLAGS = -Os
    
    
    -# Insert your own path here - it should be the same directory that contains "co
    -PROPWARE_PATH = /home/david/PropWare
    +NAME= PropWare
    +OBJS= PropWare.o spi.o spi_as.o sd.o l3g.o mcp300x.o hd44780.o
    
    
     # Optionally, specify where your compiler is installed
    -PREFIX = /opt/parallax
    +PREFIX = /c/propgcc
    +
    +all: $(NAME).elf
    +
    +include ./common.mk
    +
    
    
    -include $(PROPWARE_PATH)/common.mk
    diff --git a/PropWare.c b/PropWare.c
    index 4eb3c90..fd6370b 100644
    --- a/PropWare.c
    +++ b/PropWare.c
    @@ -4,7 +4,7 @@
      * @author  David Zemon
      */
    
    
    -#include <PropWare.h>
    +#include "PropWare.h"
    
    
     uint8_t GPIOSwitchRead_Low (uint32_t pin) {
         DIRA &= ~pin; // Set the pin as input
    @@ -35,3 +35,8 @@ uint8_t PropWareGetPinNum (const uint32_t pinMask) {
             ;
         return --temp;
     }
    +
    +int main(int argc, char *argv[])
    +{
    +    return 0;
    +}
    diff --git a/common.mk b/common.mk
    index 5a9ebac..6bc1a0e 100644
    --- a/common.mk
    +++ b/common.mk
    @@ -55,8 +55,8 @@ endif
    
    
     CFLAGS_NO_MODEL := -Wextra $(CFLAGS)
     CFLAGS += -m$(MODEL) -Wall
    -CXXFLAGS += $(CFLAGS) -Wall
    -LDFLAGS += -m$(MODEL) -fno-exceptions -fno-rtti
    +CXXFLAGS += $(CFLAGS) -Wall -fno-rtti
    +LDFLAGS += -m$(MODEL) -fno-exceptions
     INC += -I$(PROPWARE_PATH) -I $(PREFIX)/propeller-elf/include
    
    
     ifeq ($(MODEL), cmm)
    @@ -91,6 +91,7 @@ $(NAME).elf: $(OBJS)
            @echo 'Building target: $@'
            @echo 'Invoking: PropGCC Linker'
            $(CC) $(LDFLAGS) $(LIB_INC) $(LIBS) -o $@ $(OBJS)
    +       $(CC) -Xlinker -Map=$(NAME).map $(LDFLAGS) $(LIB_INC) $(LIBS) -o $@ $(OB
            @echo 'Finished building target: $@'
            @echo ' '
     endif
    diff --git a/hd44780.c b/hd44780.c
    index fc06cac..807fec7 100644
    --- a/hd44780.c
    +++ b/hd44780.c
    @@ -4,7 +4,7 @@
      * @author  David Zemon, Collin Winans
      */
    
    
    -#include <hd44780.h>
    +#include "hd44780.h"
     #ifdef HD44780_DEBUG
     #include <stdio.h>
     #endif
    diff --git a/hd44780.h b/hd44780.h
    index 94a39ee..f84c9af 100644
    --- a/hd44780.h
    +++ b/hd44780.h
    @@ -14,7 +14,7 @@
     #include <stdarg.h>
     #include <stdlib.h>
     #include <propeller.h>
    -#include <PropWare.h>
    +#include "PropWare.h"
    
    
     #define HD44780_DEBUG
    
    
    diff --git a/l3g.c b/l3g.c
    index 06afa18..64c71a3 100644
    --- a/l3g.c
    +++ b/l3g.c
    @@ -4,7 +4,7 @@
      * @author  David Zemon, Collin Winans
      */
    
    
    -#include <l3g.h>
    +#include "l3g.h"
    
    
     uint32_t g_l3g_cs;
     uint8_t g_l3g_alwaysSetMode = 0;
    diff --git a/l3g.h b/l3g.h
    index 27dcef6..2800ccf 100644
    --- a/l3g.h
    +++ b/l3g.h
    @@ -11,8 +11,8 @@
     #define L3G_H_
    
    
     #include <propeller.h>
    -#include <PropWare.h>
    -#include <spi.h>
    +#include "PropWare.h"
    +#include "spi.h"
    
    
     #define L3G_SPI_MODE            SPI_MODE_3
     #define L3G_SPI_BITMODE         SPI_MSB_FIRST
    diff --git a/max6675.c b/max6675.c
    index 234e3db..4ffab08 100644
    --- a/max6675.c
    +++ b/max6675.c
    @@ -4,7 +4,7 @@
      * @author  David Zemon
      */
    
    
    -#include <max6675.h>
    +#include "max6675.h"
    
    
     uint32_t g_max6675_cs = -1;
     uint8_t g_max6675_alwaysSetMode = 0;
    diff --git a/mcp300x.c b/mcp300x.c
    index 7de4037..ed7c3d3 100644
    --- a/mcp300x.c
    +++ b/mcp300x.c
    @@ -5,7 +5,7 @@
      */
    
    
     // Includes
    -#include <mcp300x.h>
    +#include "mcp300x.h"
    
    
     #define MCP300X_START           BIT_4
     #define MCP300X_SINGLE_ENDED    BIT_3
    diff --git a/mcp300x.h b/mcp300x.h
    index 61646fb..d0f12ba 100644
    --- a/mcp300x.h
    +++ b/mcp300x.h
    @@ -14,8 +14,8 @@
     #define MCP300X_H_
    
    
     #include <propeller.h>
    -#include <PropWare.h>
    -#include <spi.h>
    +#include "PropWare.h"
    +#include "spi.h"
    
    
     #define MCP300X_SPI_DEFAULT_FREQ    100000
     #define MCP300X_SPI_MODE            SPI_MODE_2
    diff --git a/sd.c b/sd.c
    index baf4d65..c6a558f 100644
    --- a/sd.c
    +++ b/sd.c
    @@ -5,7 +5,7 @@
      */
    
    
     // Includes
    -#include <sd.h>
    +#include "sd.h"
    
    
     #ifdef SD_DEBUG
     /* @brief   Print an error through UART string followed by entering an infinite
    diff --git a/sd.h b/sd.h
    index 286f8db..c49f002 100644
    --- a/sd.h
    +++ b/sd.h
    @@ -23,8 +23,8 @@
     #include <propeller.h>
     #include <stdlib.h>
     #include <string.h>
    -#include <PropWare.h>
    -#include <spi.h>
    +#include "PropWare.h"
    +#include "spi.h"
    
    
     /**
      * @defgroup sd FAT16/32 SD card
    diff --git a/spi.c b/spi.c
    index 7201305..335a5ec 100644
    --- a/spi.c
    +++ b/spi.c
    @@ -5,7 +5,7 @@
      */
    
    
     // Includes
    -#include <spi.h>
    +#include "spi.h"
    
    
     #ifdef SPI_DEBUG
     #include <stdio.h>
    diff --git a/spi.h b/spi.h
    index 41b1b20..3b03b1f 100644
    --- a/spi.h
    +++ b/spi.h
    @@ -11,7 +11,7 @@
    
    
     #include <propeller.h>
     #include <stdlib.h>
    -#include <PropWare.h>
    +#include "PropWare.h"
    
    
     /**
      * @brief      Extra code options - Uncomment definitions to enable features
    diff --git a/spi_as.S b/spi_as.S
    index cb9beb8..f9ee362 100644
    --- a/spi_as.S
    +++ b/spi_as.S
    @@ -8,7 +8,7 @@
      */
    
    
     #define ASM_OBJ_FILE
    -#include <PropWare.h>
    +#include "PropWare.h"
    
    
     /* NOTE: These definitions *MUST* match up with the SPI source file "spi.c" */
     // Different fuctions supported by this GAS module
    
    
    Steve@DADS-PC /c/gccdev/propside/MyProjects/PropWare (master)
    $
    
  • DavidZemonDavidZemon Posts: 2,973
    edited 2013-12-04 10:00
    That's for building an executable, which I don't want. I can get PropWare to work if I build the executable with the linker like you suggest, but I don't want a main() function in PropWare.c because it's supposed to be a library portable to other programs. The specific program I am testing with at the moment is SPI_Demo.c - code found under PropWare/PropGCC_Demos/SPI/

    Also - the directory structure might look a little weird as I have it in the git repo. I'm a fan of Eclipse and Eclipse likes to do its builds in a "Debug" folder beneath the root directory. Henceforth why I defined PROPWARE_PATH as ".." in PropWare/Makefile
  • jazzedjazzed Posts: 11,803
    edited 2013-12-04 10:07
    Ok,

    I've shown you how to successfully build using the tools provided. It's up to you to apply it however you like.
  • DavidZemonDavidZemon Posts: 2,973
    edited 2013-12-04 10:12
    Maybe I'm very confused on how libraries work. I was under the impression that I could take a single function (or a bunch of functions) and put it in a library file (libPropWare.a). I could then write a program (SPI_Demo.c) which called a function within libPropWare.a and create an executable SPI_Demo.elf. I could also write a hundred other programs that called the same function(s) within libPropWare.a and I'd never have to re-compile libPropWare.a.

    Am I missing something?

    My end goal here is not to build SPI_Demo.elf. I want to create a large library full of functions that makes the Propeller as easy to use as Arduino. If I can get this working (and I know, I have a LOT of work left in a lot more areas than just expanding the number of modules), then this ought to make the Propeller more powerful than Arduino, with just as much versatility (module files like spi.c and hd44780.c), just as easy to use, with an IDE (Eclipse) that isn't complete garbage (Arduino)
Sign In or Register to comment.