New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More built-in code for ESP8266 #770
Comments
Hi, added USE_GRAPHICS=1 and got a permanently reseting Espruino - any idea ? r��S |
using this exports
|
first success full try with reduced vars (1000)
|
got 1310 vars but very litte heap
any suggestion how to drop/shrink fonts ? |
You could instead just modify their definition to fit into Flash memory instead? |
not sure how too, any hint ? now running with a compromise of 1000 vars
|
Looks like you need something a bit like this: https://github.com/espruino/Espruino/blob/master/src/jsutils.h#L62 Ideally you'd make a new |
ok, extended jsutil.h see below can you please name a file and line where and how to use
|
Not quite sure I understand what you've done there - isn't that pretty much what's in jsutils already? I meant, something like:
Look in https://github.com/espruino/Espruino/blob/master/libs/graphics/bitmap_font_3x5.c
for rendering of the vector font you have to look into graphics.c though |
sorry, just starting with stuff like this, hope to improve day by day - thanks like to check result with
|
changed code in DISABLE_LTO=1 make used @gfwilliams Why is the contents of section .rodata or .irom.literal using so much space filled with 0x00 ? |
I have no idea - it could be zero-initialised structures? I'd have hoped that GCC would be smart enough to group them together in RAM and zero-init them with a loop, but I don't remember seeing it do that in ARM and I doubt it does for Xtensa. |
v1: v2: result: v2 shrinks irom.literal ;-) |
Wow, thanks! So I was basically allocating 5x more memory than needed! I guess all those fonts could be fixed in a similar way. |
this is what the latest Makefile from espruion/ESPRUINO uses for GRAPHICS:
changed 4x6 to 3x5 and started holy moly const unsigned short LCD_FONT_3X5 this full off syntax errors - fixed and yes same result ! pull request: #804 |
will now start some test |
decided to test ram font first, but didn't look right ?! bitmap_font_3x5.c
and bitmap_font_4x6.c
are setup with the same entries. Gordon, please double check. |
tried vector font, result looks strange
Any idea ? |
found it, something wrong with the initial setting of zigzag - no idea where to change that
|
I'm not sure what you mean? zigzag is for displays with the pixels wired in a zig-zag pattern - like the RGB123. The effect you're showing is what you'd expect if you wired it to a display that wasn't zig-zagged.
I don't think so? One is 6px deep, the other is 5px deep. Both are 3px wide (excluding the space between chars) which is a bit confusing though. |
so font 4x6 : 3x5 in 4x6 - got that my neopixel plate is zigzag wired like this 00 01 02 03 04 05 06 07 to address the pixel correctly I have to set zigzag option to false, what is in my understanding wrong compared with the docs. |
If you look, you'll see that the 4x6 font does use the bottom row occasionally, so it isn't just a 3x5 font with the bottom row left empty.
Yes, that's an entirely normal scanline-style layout. How would you lay out a grid of pixels like that in a way that was less zig-zaggy??
|
Also, the docs say |
thanks for enlighten me ! |
using font stored in irom will reboot if using drawSting() downloaded yesterdays source version found macro READ_FLASH_UINT8 in src/jsutils.h, added
tried to use it like this in file lib/graphics/bitmap_font_4x6.c
ESP still reboots, what am I missing .... @gfwilliams I need some help on this |
Why didn't you use the code I posted above? LCD_FONT_4X6 is 16 bits, so you'd need to make and use a READ_FLASH_UINT16. I don't know whether that would help, but it would be a good start. edit: it's got a typo with the Other thing you could try is commenting out the function altogether. It could be the problem is elsewhere. |
rewriting the changes correctly and TaTa, no more dump bitmap_font_4x6.c
jsutils.h
checking the result will bing up a new thing:
is showing this:
@gfwilliams any idea ? |
next test: print first six chars to console and compare with peek16()
|
@gfwilliams | @tve need some new ideas to get this right |
with all the optimization of const strings coming with the standard code in 1v85 it is possible to have 1200 vars and 5200 heap. DISABLE_LTO=1 USE_GRAPHICS=1 make
|
. |
Does the heap size just end up with whatever ram is left, or is there a setting for this? |
@wilberforce there is no setting for heap. this is my understanding of how heap is influenced:
|
heap size is what's left |
How much heap is required? I understand this is application dependent. We start with 80K and I think we loose 1/2 to the interpreter - I'm wondering how the jsVars and heap available compare to ARM implementations |
try to write own lib to understand how .irom.literal stores data. printf is not working they way I use it, any hints ?
|
using jsiConsolePrintf() with %d and ESP_READ_FLASH_UINT8 works
|
YMMV :-) |
including some lines of the LCD_FONT_3X6 array reading and print them with ESP_READ_FLASH_UINT8 and ESP_READ_FLASH_UINT16 explains whats going wrong ESP_READ_FLASH_UINT16 is not working as expected
@gfwilliams can you please suggest a new version of ESP_READ_FLASH_UINT16 that can handle this ? |
|
I'm not sure I really understand what's going on? Please can you post up the code you used to print:
The first 5 or so entries of |
|
That's working fine as far as I can tell. Note: you've got 8 How is In the original file it's |
definition:
ok as fare as i understand the type cast (char*) causes this issue, values are stored as 2 byte values , see contents of section .irom.literal this reads the low byte
this reads two times low byte of prt and ptr+1
I guess this would help: change to read high and low byte of same ptr
but I don't know how to change the rest of the line to return eg 0x6a55 |
Ahh, try:
The issue is that the pointer is to a 16 bit value, so adding 1 to it jumps 16 bits forward, not 8 as was intended. You might also need to try:
Which would reverse the order of the 2 bytes (if they turned out to be wrong) |
Yep, now all chars are correct ! Used this statements:
Next is to move this defines to jsutils.h and than continue with vector font |
jsutil.h
bitmap_font_4x6.c
|
I was going to suggest that you dropped the ESP_ prefix so this is platform agnostic - looks like you have done already! As far as the naming goes I'm wondering if there is a naming convention we can use that it will still read ok for non-rom builds. |
vector_font.h
graphics.c
test vector font
after reset
@gfwilliams do you see any thing else that can be moved to flash in GRAPHICS ? |
xtensa-lx106-elf-objdump list for all object files in libs/graphics |
Looks great! @MaBecker Nothing comes to mind... Do you think you could issue a pull request for this? |
sure ! |
created pull request 820 - 823 |
@gfwilliams I suggest to close this issue and open a new issue for USE_FILESYSTEM because I have no SSD drive to test this and work on USE_GRAPHICS is completed and as standard build for ESP in Makefile. What do you think ? |
Yeah - to be honest I think I'll just close this. I'm not sure many people will use filesystem now there is the built-in |
Hi,
I just noticed that in the
Makefile
the ESP8266 only has USE_NET. I think at the least,USE_GRAPHICS
might be handy for attaching graphics LCDs, and possiblyUSE_FILESYSTEM
- which can allow you to connect an SD card to any available pins.@tve I know you had concerns about the RAM usage, but I'd try it and see - this stuff is designed to statically allocate every little memory. I guess the only issue might the Flash usage?
The text was updated successfully, but these errors were encountered: