Linker commands

3/24/17

I have a problem I need some help with.

I have a need to be able to read and write to a buffer file by two different libraries. The buffer also needs to be accessible from the main program.

How do I get this done?? Where do I declare (or set it up) the buffer?? How do I access it from the individual libraries??

Any help you can provide will be greatly appreciated.

Ken

Declare your buffer where both libraries and your code and see it.

What libraries? Do you have any part of a sketch? if so show it please. What exactly is your sketch intended to do? What part numbers are in your project?

03/25/17

Goof Morning All:

Sorry, I see that I was a little to brief on my discussion. Here is what I have done and what I want to do.

I am running two ADA Part Nr. 250 GLCD displays (the displays use a ST7565 controller) with the same processor (Mega 2560). Since the library provided for the displays does not allow for this. I had to get creative.

First, I made a copy of the library and renamed it ST7565A. With that done, I went into the library and changed every reference of "ST7565" to "ST7565A" and every reference of "GLCD" to "GLCDA".

The next thing I had to do was to change the names of all of the functions in the library using the same technique (ie from Drawstring to DrawstringA, from "Set_Pixel to Set_PixalA).

Basically, now I effectively have two different displays to work with ST7565 glcd and ST7565A glcdA.

This allows me to declare them separately using:
ST7565 glcd(MOSI, SCLK, DC, RST, CS); and

ST7565A glcdA(MOSI, SCLK, DC, RST, CS);

It also means that I can send each of them data as desired separately using their own function calls.

The Problem:
As with most LCD, GLCD and OLED displays, the processor is require to provide a buffer for the display. Since these displays are 128/64 bit displays, they requires a 1024 byte buffer (128*64/8 = 1024).

Additionally, since these libraries were designed to run on their own, they setup their own buffers (ST7565 Buffer and ST7565A Buffer). This effectively consumes 2048 byte of Variable RAM.

Because we cannot write to both of the displays at the same time and when we do write to the displays, we first have to write to the buffer (i.e. glcd.drawstring(30, 0, " Screen1"); ) followed by a command to send the data in the buffer to the display (i.e. glcd.display():wink: there really is no need for two buffers.

What I want to do is to setup one buffer that both libraries can see and use. I suspect the main program would also have to see the buffer but I am not sure of that. If I could get this done, I would save 1024 bytes of very valuable Variable RAM.

I know this can be done and I suspect that it would be done through some kind of #Include statement but I have no idea of how to do that. (I am not a programmer and have never been one).

I hope this helps and provides enough detail to allow someone to get me pointed in the right direction.

I know that this is a real "Brute Force" method to get the job done but I am no programmer and really don't understand a lot of what is going on in the library and this technique albeit inefficient, worked.

If you want to see the libraries, I can include them but that would make this a really long post. If you want to see them so you can use them, I don't have a problem with that, just let me know where to send them.

Any help you can provide will be greatly appreciated.

Ken

If you want to see the libraries, I can include them but that would make this a really long post.

You need to post them. It is almost certain that you did not need to rename all the methods in the class that you renamed. It is almost certain that you did not need to make a copy of the library with a different name.

You need to explain why you think you needed to do that.

Changing the private buffer to a public buffer is possible. Changing the public buffer to a global buffer is probably possible.

With a common buffer, both display will show the same image, why would you like to do that?

03/27/17

As far as displaying the same image on both displays, NO I don't want to do that. It is my understanding that the contents of the buffer(s) are not sent to the display until you issue the "glcd.display" command. I may be wrong.

I have included a copy of one of the libraries. This would drive one of the displays. The second library is the same except I have changed the names of all of the calls and functions.

As for making the buffers public ?? That is over my head at this point.

I did notice that the display buffer as listed in the "Private" section in the ST7565.h file is commented out. I did not do that.

I tried to include the Libraries in this post but the Forum will not allow enough space (<9000 Char). As such, I am including the ST7565.h and ST7565.cpp files as a attachments.

Thanks again for all of your help

Ken

ST7565.h (3.65 KB)

ST7565.cpp (15.4 KB)

You should have a look at GitHub - olikraus/u8glib: Arduino Monochrom Graphics Library for LCDs and OLEDs which seems to support your chip and does not use a buffer.

03/27/17

Will do.

I'm having other issues as well.

Thanks for the input

Ken