Library Source Code

Post your requests and ideas on the future development of mikroPascal.
Author
Message
gbh
Posts: 43
Joined: 24 Jan 2005 14:59
Location: London, UK

Library Source Code

#1 Post by gbh » 18 Feb 2005 20:08

I'm experimenting with Manchester encoding in low-end 12F PICs but your standard library fuctions appear only to apply to the 16 and 18 range of PICs (presumably due to code size).

Its become common practice for software houses to include the source code to their libraries supplied with the compiler - my copy of Borland Delphi for example comes with complete source code for the VCL, etc.

Would you consider making the source code for the pre-compiled mikroPascal libraries available us - or perhaps only to registered compiler users?

I'm sure many mikroPascal users would find it both a valuable educational reference and a great help in debugging / porting to other devices.

Many thanks
Last edited by gbh on 14 Mar 2005 17:30, edited 1 time in total.

gbh
Posts: 43
Joined: 24 Jan 2005 14:59
Location: London, UK

#2 Post by gbh » 23 Feb 2005 12:04

I had been holding back on my purchase of the mikroPascal compiler (and EasyPIC 2 development board) until a reply was posted, but having used the demo software for a couple of weeks now (and being very impressed with it) I decided to press ahead and order it anyway!

Having researched other compiler vendors on the web, it seems to me that most (if not all) supply the source code to their libraries to registered users.

As well as helping to port code to other PIC types, I feel that access to the library source would also help myself (and fellow development board users) debug our applications without having the nagging doubt that any fault may lie with the library code (and consequently raise a 'fault' with yourselves in the general forum for you to investigate).

My last concern would be one of confidence. When I go into production (as is my plan) with a commercial product developed in the mikroPascal environment, I'd be very reticent indeed to include routines from the development library - as I would not be able to support them effectively and independently - which rather dimishes their value in the first place.

Have you had any further thoughts on this? What do others feel?

Many thanks,
Gary

gambrose
Posts: 369
Joined: 28 Sep 2004 17:34
Location: uk

#3 Post by gambrose » 23 Feb 2005 16:36

I agree that at least some of the libraries should be opened up.

Perhaps you could have 'partner' relations with customers were certain developers can get special access to code to develop it.
But with out all the 'new' users reading too much into code they don't understand.
Graham Ambrose

LGR
Posts: 3204
Joined: 23 Sep 2004 20:07

#4 Post by LGR » 23 Feb 2005 16:49

Let me add a different perspective ... I am not so concerned with knowing what is in the libraries, as I am with being able to toss out extraneous portions which are either not needed in the specific application, or are convoluted because of the need to provide flexibility in a binary library. An example would be setting the ports and pins for the LCD/GLCD libraries. It would be so much cleaner to simply declare the parameters as constants, and not have to call these long procedures with long argument lists. I suspect that there would be a significant reduction in hex, as well.

Binary procedures have their place, but sometimes they are clumsy. And of course, if you are having a problem, and trying to understand what is happening, it is easier to follow source than ASM. :x

I suspect that these libraries are commented in Serbian, and there may be some reluctance to release that. I wouldn't worry about that, The GLCD example was also commented in Serbian, and having the source was better than not having it. It wasn't hard to figure out the general program flow, and how to modify it.

gbh
Posts: 43
Joined: 24 Jan 2005 14:59
Location: London, UK

#5 Post by gbh » 23 Feb 2005 17:06

Thanks for the general support - however I was basing my request on making the library source code available to all registered users - as is usual with other compiler vendors.

To limit it to just 'some' of the libraries would mean that I'd still be reluctant to incorporate functions from libraries to which I didn't have access to the source in any commercial application. And who would decide which libraries?

You raise a further good point however in that it may spur some customers to add to and customise the library functions - adding new functionality to existing libraries and possibly sharing it with other users (and mikroElektronika).

I don't quite agree your comment that new users could read too much into code they don't understand. I personally learned as much from books as I did from looking through the source code of the Delphi VCL.

LGR
Posts: 3204
Joined: 23 Sep 2004 20:07

#6 Post by LGR » 23 Feb 2005 18:03

gbh wrote:I don't quite agree your comment that new users could read too much into code they don't understand..
I think that the concern is that a little knowledge can be dangerous sometimes, and the support forums may be clogged with questions that shouldn't be asked. While you are developing a commercial product, a significant number of users are hobbyists or students. In general, the first choice for library functions should be that they are used as "turnkey" or "black box" devices. If you are going to ask what's inside, you need to take responsibility for the ramifications of fiddling.

As a practical matter, if these binary procedures are turned loose in the hands of enough people, they will either come to be considered reliable, or will develop a pattern of known quirks which can be worked around. I don't think that reliablilty in a commercial product is a question provided that they have been used by enough different users in enough different applications. The value of the feedback is improved when we know that everyone is using the same unmodified routines.

What will be most important is getting some feedback on how thoroughly these routines have been tested, and what the known quirks are. I think that this is an area where the forum can be improved to include bug tracking. I would be more concerned about improving the bug tracking system if you are concerned about reliability. It is somewhat unusual for a bug to pop up out of nowhere after months or years of operation (though it can happen).

Frankly, I don't know where the reluctance to publish these to registered users comes from. If there is a desire to protect IP, Pascal is the ideal language, because there is no other Pascal compilers for PICs out there (except for a Pascal-to-C cross compiler). It may have more to do with documentation and support. :?:

gbh
Posts: 43
Joined: 24 Jan 2005 14:59
Location: London, UK

#7 Post by gbh » 23 Feb 2005 18:18

I take on board your points.

I haven't seen a reluctance to publish the source to registered users - I'm still awaiting comment from the guys at mikroElektronika.

I'd be happy for the original compiled libraries to be supported, and the source to be issued as-is, regardless of the language it is commented in.

LGR
Posts: 3204
Joined: 23 Sep 2004 20:07

#8 Post by LGR » 23 Feb 2005 18:45

gbh wrote:I'd be happy for the original compiled libraries to be supported, and the source to be issued as-is, regardless of the language it is commented in.
Exactly.

I hope that I have this story correct, but as I recall, the open source/GNU movement was started over precicely such an issue. I believe that it was a research physicist trying to get his Xerox printer to do something that it wouldn't do. At the time, proprietary binary software was new, and the tradition from the days of mainframes was to provide software free of charge and in source form.

After contacting Xerox, he was told that the driver wouldn't do what he wanted. He requested the source, so that he could add the feature himself. He was told that that wasn't possible. He got mad, and developed the GNU agreement. All he really wanted was to tweak his printer driver. Instead, Xerox tweaked him. :P

gbh
Posts: 43
Joined: 24 Jan 2005 14:59
Location: London, UK

#9 Post by gbh » 11 Mar 2005 20:56

Anyone at mikroElektronika had a chance to formulate thoughts on this suggestion?

Thanks

gbh
Posts: 43
Joined: 24 Jan 2005 14:59
Location: London, UK

#10 Post by gbh » 18 Mar 2005 12:52

Another week on, and a whole month since my original posting... Anyone at mikroElektronika had a chance to formulate thoughts on this suggestion?

LGR
Posts: 3204
Joined: 23 Sep 2004 20:07

#11 Post by LGR » 18 Mar 2005 15:42

*** Crickets ***

Synologic
Posts: 13
Joined: 13 Mar 2005 20:23
Location: Romania

#12 Post by Synologic » 18 Mar 2005 16:21

Well,

shouldnt be available only to registered users, but for other users too, i recently purchased an easypic2 and cf adapter and my efforts towards writing code to access the CF card using another C compiler, failed miserably, for some reason the mirkopascal examples work just fine, but my code which is based on other CF codes written for PIC just doesnt want to work.

I would really like to take a closer look at the compact flash library from mikroelektronika to figure out what im doing wrong, because apparently there is no reason for it not to work ...

LGR
Posts: 3204
Joined: 23 Sep 2004 20:07

#13 Post by LGR » 18 Mar 2005 17:25

Synologic wrote:for some reason the mirkopascal examples work just fine, but my code which is based on other CF codes written for PIC just doesnt want to work.

I would really like to take a closer look at the compact flash library from mikroelektronika to figure out what im doing wrong, because apparently there is no reason for it not to work ...
This is a good example of where an excerpt of the source would be helpful. Of course, you can always examine the ASM listing generated by the compiler. It includes the ASM of the library functions. The ASM listings are automatically generated, but they are actually not as hard to follow as you would think.

Synologic
Posts: 13
Joined: 13 Mar 2005 20:23
Location: Romania

#14 Post by Synologic » 18 Mar 2005 18:06

Yes i agree on ASM part, but im not very knowledgeable with ASM language :)

my code in C is as follows:

address = 7;
output_bit(CF_ADRESS_0,bit_test(address,0));
output_bit(CF_ADRESS_1,bit_test(address,1));
output_bit(CF_ADRESS_2,bit_test(address,2));

sets the CF register for receiving commands

after this code i tried with and without strobing the write line, some documentation mentions that one needs to strobe the write line after putting the register address, others dont,

output_d(0xEC);
output_low(CF_WRITE); // Strobe Write Line
delay_us(300);
output_high(CF_WRITE);

here, i put the identify drive command on portd and strobe the write line

address = 0;
output_bit(CF_ADRESS_0,bit_test(address,0));
output_bit(CF_ADRESS_1,bit_test(address,1));
output_bit(CF_ADRESS_2,bit_test(address,2));

then i put 0 for generic read/write on the address line

output_low(CF_READ); // Strobe Read Line
delay_us(300);
cd=input_D(); // Read Data Bus
output_high(CF_READ);

then strobe the read line and get the input from portd
note that i wait 300 us for the command to be processed by the card, again some code do that, some code dont do that, some code waits for the READY line to become active (again tried all ways)

for two consecutive reads, first returns 0xEC (which i just wrote to the port) and second read returns 0.

Some examples i read, besides the CF 3.0 specifications include the code from www.mpic3.com which is based on another source code snippet i found (dont remember the link now). I even read some AVR code which i found on the net, which practically does the same thing.

gbh
Posts: 43
Joined: 24 Jan 2005 14:59
Location: London, UK

#15 Post by gbh » 06 Apr 2005 11:01

Almost another 3 weeks have passed since my last plea for a statement re. library source code availability. It's been 7 weeks since my original posting and still no reply. :(

I like the comment from another user in the mikroPascal forum on an unrelated problem...
..."source code could be a step in the good direction, i could then see what is wrong. As it is today it is like trying to find your way blindfolded in a dark tunnel"

Without access to the library source mikroPascal is more like a closed system, rather than a development system.

I know you guys are tied up with compiler development, but could you consider your policy here please, and let us know.

Many thanks

Post Reply

Return to “mikroPascal Wish List”