SUCCESS: Converting mbed C++ to C to Propeller GCC.... BUG-B-GONE
idbruce
Posts: 6,197
Hello Everyone
I am at a point in the Teacup port where I really need some answers pertaining to various hardware issues. One of those issues is being able to communicate with an ADC breakout board that I purchased from Adafruit several months ago. On the Adafruit website, they provided some source code to interace the ADC, but of course it certainly was not Propeller friendly , and of course I have been working on changing that. Basically as the title states, I have been attempting to convert mbed C++ to Prop-GCC, and I believe I have it very, very close, but I now have a Prop-GCC issue that I cannot understand or resolve. They say a picture says a thousand words, so I am including an image of the build status pane. As you can clearly see, there is an undefined reference to "_st_mark". _st_mark is basically used by the waintcnt function and it is clearly defined as an extern variable within simpletools.h, so I am befuddled
In addition to the image, I am also including a project archive, as well as an archive of the original source code before modification.
Any help would be greatly appreciated. Thanks.
Bruce
EDIT: I suppose that I should also inform you that I have other projects that use waitcnt and still compile just fine, so this is a project specific issue.
I am at a point in the Teacup port where I really need some answers pertaining to various hardware issues. One of those issues is being able to communicate with an ADC breakout board that I purchased from Adafruit several months ago. On the Adafruit website, they provided some source code to interace the ADC, but of course it certainly was not Propeller friendly , and of course I have been working on changing that. Basically as the title states, I have been attempting to convert mbed C++ to Prop-GCC, and I believe I have it very, very close, but I now have a Prop-GCC issue that I cannot understand or resolve. They say a picture says a thousand words, so I am including an image of the build status pane. As you can clearly see, there is an undefined reference to "_st_mark". _st_mark is basically used by the waintcnt function and it is clearly defined as an extern variable within simpletools.h, so I am befuddled
In addition to the image, I am also including a project archive, as well as an archive of the original source code before modification.
Any help would be greatly appreciated. Thanks.
Bruce
EDIT: I suppose that I should also inform you that I have other projects that use waitcnt and still compile just fine, so this is a project specific issue.
Comments
I really don't like to see "-LC:/......../cmm/\libsimpletools.a" in that output. There should only be "/" or "\" depending on operating system.
What I expect to see is a "-lsimpletools.a" in the final link command somewhere. Otherwise the simpletools library is not being used at all. Perhaps try adding that to the build options in SimpleIDE or whatever you are using.
Edit: Please don't post images of compiler error messages. It make it very hard to copy and paste bit's of it back into replies when trying to answer the question. Just cut and paste the text as a code block here.
I found it... I forgot to change wait to waitcnt in the main.
Or is CNT something different in simpletools or your program ?
LOL... I meant to declare a variable and assign it with CNT.
Anyhow the main has been altered to this.... replacing waitcnt with pause...
and all references to waitcnt within Adafruit_ADS1015.c have been replaced with: pause(m_conversionDelay);
It now compiles fine, but the question is..... Does it function like it should???????
EDIT: In reference to that last question, I added two functions to Adafruit_ADS1015.c, write_i2c and read_i2c. These two functions pass their parameters onto i2c_out and i2c_in. I am not sure if I am placing the parameters correctly.
I have faith that all it will need is a few alterations, if any, because I believe it is ready, with the possible exception of the paameters being passed to i2c_out and i2c_in.
As far as testing goes.... I am going to see if I can set up something on the Prop BOE, with a pot set up in a similar fashion as the various thermistors will be setup on the controller.
The library directory within your SimpleIDE project's is set as Read/Write for owner only. It would not build on my system until I reset permissions. This is a bit less than optimal for projects that you intend to publish in the forums for help in debugging. This may also be an indicator that portions of your project's paths are generally set this way. You may want to open-up your project files as a general rule as you may end up with build errors that are difficult to debug.
dgately
Thanks for the heads up
On my machines something like SimpleIDE gets installed to /opt/parallax or wherever with me as the owner. read/write for owner only is quite OK. I don't have anyone else using my machine.
I never have any problems opening any files. I wonder what OS dgately is using. The project folder is read only, while all the files inside don not have any permissions set.
Here's what the project looks like when unzipped:
dgately
Don't look at me..... I did not set any permissions. SimpleIDE store projects to MyDocuments. All I did was create an archive. Heck, I never even use MyDocuments except for SimpleIDE
I meant the package under discussion, that is whatever dgately unzipped above. Conveniently created so that the intended user can't see it.
Just exactly what are you trying to say?
My point was that if the package gets installed by root/admin but then the files it provides cannot be accessed by the intended normal users that is a bit broken. Not very broken as such permission problems are easily sorted as Dave and dgately said.
Now I'm not sure what dgately is showing us. The listing shows he is in his ~/Downloads/MyADC directory and all the files seem to have usable permissions set.
But then he shows the output of the "ls -al library/" command issued in the same directory and there is a bunch or errors "....: Permission denied". So obviously permissions inside the library directory incorrect. But we don't get to see what they are actually set to.
Oh, and how come the library directory has no "x" bits set on it?
As far as the 'x' bits, windows has no 'x' bits as far as I know - how/why would it convey that information in that case?
Just pondering......
By the way, I have put together my test setup and tested. I do have a problem, but I believe it is how I am passing the data in the i2c_out and i2c_in functions, however not sure just yet. It shouldn't be long though.
I would think if you archive something on one system, you should be able to unarchive it in a more directly usable form on the other system.
I'm not even sure what *nix to *nix does as far as users and groups go. I almost want to go experiment.
During my repeat loop.....
I have gone from repeatedly printing 2, with no response to pot adjustment
to
repeatedly printing 4095, with no response to pot adjustment
to
repeatedly printing 0, with no response to pot adjustment
LOL.... I altered the code just a little and removed two functions. Now I am calling i2c_in and i2c_out from readRegister and write register.
I'm pretty sure this is an issue of moving things from Windows out into the normal world. So, like many such headaches and inconveniences in the modern computing world we can blame Bill Gates.
Bruce, glad you've got some results now!
dgately
Perhaps you are onto something there.
Of course the bug is that it produces zip files instead of compressed tar balls.
Thanks dgately
For those of you who did not look at the source, it is some pretty serious source code for controlling an adc, with all the bells and whistles. Additionally, here is the adc breakout board that the source code is for: http://www.adafruit.com/product/1083
Just look at the specs.... It is a 4 channel 12 bit, but this code could easily be modified for the ADS1115 which is 4 channel 16 bit. Of course you do not have to buy the breakout board, just the chip, because the code will run it. And with a few mods, the 16 bit could be at your disposal.
Anyhow, here it is in working order And dgately, sorry about any permissions that may be screwy, but I do not know how to fix that problem.