Shop OBEX P1 Docs P2 Docs Learn Events
Bizarre symbol names from pst.dat in Simple — Parallax Forums

Bizarre symbol names from pst.dat in Simple

DavidZemonDavidZemon Posts: 2,973
edited 2014-08-30 21:03 in Propeller 1
I'm adding support for .dat files to PropWare (this will allow use of FDSerial from PropWare projects). The line that copies pst.dat to pst.dat.o looks like:
/opt/parallax/bin/propeller-elf-objcopy -O elf32-propeller -I binary -B propeller /home/david/External/Kits/Embedded/Parallax/Library/PropWare/simple/pst.dat CMakeFiles/Simple_cog.dir/__/pst.dat.o
Which seems to match up pretty well with line 66 of a file in propgcc.

Unfortunately, that yields some very ugly symbols in pst.dat.o, as propeller-elf-nm shows:
pst.dat.o:
00000150 D _binary__home_david_External_Kits_Embedded_Parallax_Library_PropWare_simple_pst_dat_end
00000150 A _binary__home_david_External_Kits_Embedded_Parallax_Library_PropWare_simple_pst_dat_size
00000000 D _binary__home_david_External_Kits_Embedded_Parallax_Library_PropWare_simple_pst_dat_start

Is there an easy way to fix this? How does SimpleIDE do this?

David

Comments

  • jazzedjazzed Posts: 11,803
    edited 2014-08-28 18:17
    How does SimpleIDE do this?


    Make a simpleide project and find out.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-08-28 18:19
    I'm adding support for .dat files to PropWare (this will allow use of FDSerial from PropWare projects). The line that copies pst.dat to pst.dat.o looks like:
    /opt/parallax/bin/propeller-elf-objcopy -O elf32-propeller -I binary -B propeller /home/david/External/Kits/Embedded/Parallax/Library/PropWare/simple/pst.dat CMakeFiles/Simple_cog.dir/__/pst.dat.o
    
    Which seems to match up pretty well with line 66 of a file in propgcc.

    Unfortunately, that yields some very ugly symbols in pst.dat.o, as propeller-elf-nm shows:
    pst.dat.o:
    00000150 D _binary__home_david_External_Kits_Embedded_Parallax_Library_PropWare_simple_pst_dat_end
    00000150 A _binary__home_david_External_Kits_Embedded_Parallax_Library_PropWare_simple_pst_dat_size
    00000000 D _binary__home_david_External_Kits_Embedded_Parallax_Library_PropWare_simple_pst_dat_start
    

    Is there an easy way to fix this? How does SimpleIDE do this?

    David
    You need to be in the directory where the .dat file resides when you issue the command. That will get rid of all of the path information.
  • DavidZemonDavidZemon Posts: 2,973
    edited 2014-08-28 18:33
    here's SimpleIDE's command.
    propeller-elf-objcopy -I binary -B propeller -O propeller-elf-gcc --redefine-sym _binary_cmm_pst_dat_start=_binary_pst_dat_start --redefine-sym _binary_cmm_pst_dat_end=_binary_pst_dat_end --redefine-sym _binary_cmm_pst_dat_size=_binary_pst_dat_size cmm/pst.dat cmm/pst_firmware.o
    

    Thanks for the tips. I should be able to figure out something from here.

    @David Betz:
    Unfortunately that's not an option (it'd require some serious hacking). I'm using CMake for this and therefore don't have control over the directory.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-08-28 18:36
    here's SimpleIDE's command.
    propeller-elf-objcopy -I binary -B propeller -O propeller-elf-gcc --redefine-sym _binary_cmm_pst_dat_start=_binary_pst_dat_start --redefine-sym _binary_cmm_pst_dat_end=_binary_pst_dat_end --redefine-sym _binary_cmm_pst_dat_size=_binary_pst_dat_size cmm/pst.dat cmm/pst_firmware.o
    

    Thanks for the tips. I should be able to figure out something from here.

    @David Betz:
    Unfortunately that's not an option (it'd require some serious hacking). I'm using CMake for this and therefore don't have control over the directory.
    You can certainly do what SimpleIDE does as well. It's not so bad when there are only two symbols you're interested in. There really ought to be a command line option to objcopy to strip the path names from the generated symbols.
  • DavidZemonDavidZemon Posts: 2,973
    edited 2014-08-28 18:41
    David Betz wrote: »
    You can certainly do what SimpleIDE does as well. It's not so bad when there are only two symbols you're interested in. There really ought to be a command line option to objcopy to strip the path names from the generated symbols.

    I agree - there really ought to be. But... that won't be good at all for me. I'm going to need the path name in there. I compile this object once for each memory model and the path will be the easiest way for me to determine the current model. I'm going to end up writing a script that parses the nm output.

    I could more quickly hard code the options for this file - but this needs to be a template for any dat file, not just pst.dat
  • David BetzDavid Betz Posts: 14,516
    edited 2014-08-28 18:45
    I agree - there really ought to be. But... that won't be good at all for me. I'm going to need the path name in there. I compile this object once for each memory model and the path will be the easiest way for me to determine the current model. I'm going to end up writing a script that parses the nm output.

    I could more quickly hard code the options for this file - but this needs to be a template for any dat file, not just pst.dat
    I guess cmake must not be as flexible as make because we have makefiles that handle this.
  • DavidZemonDavidZemon Posts: 2,973
    edited 2014-08-28 18:46
    correct. cmake does lots of stuff automagically for you. it's really nice but it takes a completely different way of thinking and can make a lot of things a PAIN IN THE
  • DavidZemonDavidZemon Posts: 2,973
    edited 2014-08-28 18:47
    but on the bright side, my output is colored in the terminal! that makes it all worth it
  • David BetzDavid Betz Posts: 14,516
    edited 2014-08-28 19:30
    correct. cmake does lots of stuff automagically for you. it's really nice but it takes a completely different way of thinking and can make a lot of things a PAIN IN THE
    As I'm sure you know, writing Makefiles isn't a great joy either...
  • DavidZemonDavidZemon Posts: 2,973
    edited 2014-08-28 19:32
    David Betz wrote: »
    As I'm sure you know, writing Makefiles isn't a great joy either...

    Ha ha :P oh yes. Your Makefiles in propgcc have been a huge help though. PropWare would not have gotten started without them as templates.
  • DavidZemonDavidZemon Posts: 2,973
    edited 2014-08-30 06:58
    As far as I can tell... those --rename-symbol arguments aren't doing anything. But alas - I just abused the folder naming scheme to make the symbols have the correct name. The file is copied to the system temp directory and then objcopy is called and then the result copied back to the desired location. Alls good now!
  • David BetzDavid Betz Posts: 14,516
    edited 2014-08-30 20:44
    As far as I can tell... those --rename-symbol arguments aren't doing anything. But alas - I just abused the folder naming scheme to make the symbols have the correct name. The file is copied to the system temp directory and then objcopy is called and then the result copied back to the desired location. Alls good now!
    Are you sure you have the order of the symbol names right? The syntax is old=new, not new=old which would make more sense.
  • DavidZemonDavidZemon Posts: 2,973
    edited 2014-08-30 21:03
    David Betz wrote: »
    Are you sure you have the order of the symbol names right? The syntax is old=new, not new=old which would make more sense.

    I most definitely had the syntax wrong. That explains everything. I'm not touching it now though; having the Python script copy the file to a temp directory turned out to be waayy easier than the three step process of: run objcopy, examine output with nm, run objcopy again.
Sign In or Register to comment.