Shop OBEX P1 Docs P2 Docs Learn Events
Patching __cfg_sdspi_config1 with 00000000 — Parallax Forums

Patching __cfg_sdspi_config1 with 00000000

Little-endianLittle-endian Posts: 91
edited 2015-01-06 07:00 in Propeller 1
To make a long story short I was having some issues trying to get SD card I/O working in a new propeller project I'm working on. I've never used SD card I/O so some issues and learning experiences are to be expected. I did read up on implementing SD card I/O searching previous forum threads as well as the learn pages. After some issues, I went back and tested the included learn examples and get the "Patching __cfg_sdspi_config1 with 00000000" messages below. SD Minimal does run however, and I do get the correct output in the terminal window.

Are these messages normal? Should the SD Minimal example consume 17860 bytes?

I did just upgrade yesterday to Simple IDE v1.0.2 (RC2)

For my other project it hangs when I include the "sd_mount(DO, CLK, DI, CS); " line in my program. I comment out this line and it runs w/o SD I/O, of course. I'm wording if this issue is causing the issues I'm experiencing with my other application.


propeller-elf-gcc.exe -v GCC 4.6.1 (propellergcc_v1_0_0_2408)
propeller-elf-gcc.exe -I . -L . -I C:/Documents and Settings/me/My Documents/SimpleIDE/Learn/Simple Libraries/Utility/libsimpletools -L C:/Documents and Settings/me/My Documents/SimpleIDE/Learn/Simple Libraries/Utility/libsimpletools/cmm/ -I C:/Documents and Settings/me/My Documents/SimpleIDE/Learn/Simple Libraries/Text Devices/libsimpletext -L C:/Documents and Settings/me/My Documents/SimpleIDE/Learn/Simple Libraries/Text Devices/libsimpletext/cmm/ -I C:/Documents and Settings/me/My Documents/SimpleIDE/Learn/Simple Libraries/Protocol/libsimplei2c -L C:/Documents and Settings/me/My Documents/SimpleIDE/Learn/Simple Libraries/Protocol/libsimplei2c/cmm/ -o cmm/SD Minimal (1).elf -Os -mcmm -m32bit-doubles -fno-exceptions -std=c99 SD Minimal (1).c -lm -lsimpletools -lsimpletext -lsimplei2c -lm -lsimpletools -lsimpletext -lm -lsimpletools -lm
propeller-load -s cmm/SD Minimal (1).elf
Patching __cfg_sdspi_config1 with 00000000
Patching __cfg_sdspi_config2 with 00000000
propeller-elf-objdump -h cmm/SD Minimal (1).elf
Done. Build Succeeded!

propeller-load.exe -Dreset=dtr -I C:/Program Files/SimpleIDE/bin/../propeller-gcc/propeller-load/ cmm/SD Minimal (1).elf -r -p COM13
Propeller Version 1 on COM13

Patching __cfg_sdspi_config1 with 00000000
Loading cmm/SD Minimal (1).elf to hub memory

17860 bytes sent

Verifying RAM ...
OK

Comments

  • David BetzDavid Betz Posts: 14,516
    edited 2015-01-04 02:39
    The "patching" lines are not errors. They simply say that the loader has taken information from your board configuration file and used it to set the initial values of variables in your program. This is usually used to tailor a program for a specific board, usually by setting pin numbers used by peripherals like SD cards. If this isn't working for you, it's probably because you have the wrong board configuration file selected or there is an error in the file.
  • Little-endianLittle-endian Posts: 91
    edited 2015-01-04 09:00
    Thanks David. I'm using the Propeller Professional Development Board (PPDB) and have been using the "GENERIC" board type on the Project Options tab. Is this the correct board type I should be using?
  • David BetzDavid Betz Posts: 14,516
    edited 2015-01-04 09:07
    Thanks David. I'm using the Propeller Professional Development Board (PPDB) and have been using the "GENERIC" board type on the Project Options tab. Is this the correct board type I should be using?
    I'm not sure what SimpleIDE uses for it's GENERIC board type. I was unable to find generic.cfg in the release_1_0 repository for propgcc or in my installation of SimpleIDE. Can you post your copy of that file?
  • Little-endianLittle-endian Posts: 91
    edited 2015-01-04 10:18
    David Betz wrote: »
    I'm not sure what SimpleIDE uses for it's GENERIC board type. I was unable to find generic.cfg in the release_1_0 repository for propgcc or in my installation of SimpleIDE. Can you post your copy of that file?

    I just looked in my c:\Program Files\SimpleIDE\propeller-gcc\propeller-load\ directory and don't see anything named generic there either.

    I've only started using SimpleIDE recently and choose GENERIC when I started since nothing else on the list appeared to be a better match for the PPDB.

    On another note, I've been able to narrow down the specific line that's causing my program to hang. I'm using two 7700 byte character arrays and a few other much smaller character arrays.

    These are defined in my main() function and I then initialize them using memset: memset(&msgBuf[0], 0, 7700);

    memset works fine on the first one an in hangs on the second one whenever sd_mount(DO, CLK, DI, CS); is included in my main function.

    This was working fine and continues to work fine as long as I don't include the line: sd_mount(DO, CLK, DI, CS);

    So this is where I am now, trying to figure out why this doesn't work when sd_mount(DO, CLK, DI, CS); is included. I'm either running out of memory or cannot get a enough contiguous memory for the second 7700 byte buffer. Any suggestions on how I can confirm this is the issue?
  • David BetzDavid Betz Posts: 14,516
    edited 2015-01-04 10:31
    I guess if you're using sd_mount and passing it pin numbers then it probably doesn't matter what value the patched variables have. A fair amount of effort was put into variable patching because it was a Parallax goal to have a single .elf file run on multiple boards without having to recompile. Unfortunately, when they developed SimpleIDE and the libraries that go with it, they abandoned that feature in favor of passing pin numbers and other configuration parameters explicitly. The propeller-load program should really be simplified to remove the variable patching feature since it is not used or supported by Parallax anymore. I think you can probably safely ignore the messages about patching variables if you're using the Simple Libraries.
  • Dave HeinDave Hein Posts: 6,347
    edited 2015-01-05 11:38
    As far as I know the PPDB doesn't have an SD card, so I assume you have wired one to the board. Did you wire it up the same as the PropBOE with DO, CLK, DI and CS on pins 22, 23, 24 and 25? If not, you will need to change the values of DO, CLK, DI and CS in "SD Minimal.c" to match your pin configuration. Also, the pins for DO and DI could be swapped depending on how you interpreted the data direction.

    It seems that SimpleIDE no longer uses the SD pin values in the config file when building a binary, and sd_mount or dfs_mount must be called explicitly. However, I do know that the pin values in the config file are used when downloading a file to the SD card. I use this feature quite a bit, and the correct board config file must be used when performing this function.

    If you have two buffers of 7,700 bytes each you are probably running out of memory. The two buffers are using almost half of the hub RAM, and your code with the file routines are probably using up the other half. As a test try reducing the size of the 7,700 buffers to something smaller to see if that works.
  • Little-endianLittle-endian Posts: 91
    edited 2015-01-06 05:44
    Hi Dave, Thanks for your help. Yes, the PPDB doesn't have a SD card socket so I'm using one I purchased a while back from ucontroller.com. I have it wired to pins P0-P3 on the Propeller and updated the values in SD Minimal accordingly for DO, CLK, DI, and CS. SD Minimal does run successfully. I do suspect I'm running out of memory and was wondering if there's any way to verify this? I did try reducing one of the byte arrays and had to go all the way down to about 10 bytes or so to get it to work.

    I'm using SimpleIDE and using the "CMM Main RAM Compact" memory model. None of the other memory models seem to work with the PPDB.

    I realize two 7700 byte arrays are huge and I'm investigating ways to eliminate one of them and reduce the size of the other.

    I was also wondering if there's any way I can use one of other memory models (I realize I may need to use a different board) to overcome this issue as well?

    I see the overview of the memory models here: https://sites.google.com/site/propellergcc/documentation but don't fully understand all of it yet.

    As a side note, I just tried compiling using the "LMM Main RAM" memory model and get the follow error:

    c:/program files/simpleide/propeller-gcc/bin/../lib/gcc/propeller-elf/4.6.1/../../../../propeller-elf/bin/ld.exe: region `hub' overflowed by 7336 bytes

    So I think that explains it...I just don't get that error message when using the "CMM Main RAM Compact" memory model.
  • Dave HeinDave Hein Posts: 6,347
    edited 2015-01-06 07:00
    If you haven't already done so, try enabling the "Simple printf" option under the Compiler options. This should reduce the amount of code space used. There is also a "Tiny lib" option under the linker options. I'm not sure what this includes, but you may want to try this also.
Sign In or Register to comment.