Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Overlays Tec hnique 
Ron & Grégoire
What's an overlay ? 
In a general computing sense, overlaying means 
"replacement of a block of stored instructions or 
da...
Overlay mapping 
Overlays technique 3
Our Build Proc es s 
1.Generate an initial LD script 
2.First build of the app 
3.Calculate the size of the overlay sectio...
Generate the initial LD s c ript 
Overlay configuration 
Selecting files (from sources or libraries) for every 
overlay se...
Generate the initial LD s c ript 
Overlays technique 6 
Generated LD 
script 
1 / 8
F irs t build of the app 
Overlays technique 7 
pebble build 
The overlays sections are mapped at a 
default hard-coded po...
Calc ulate the overlay s ec tion 
s ize 
arm-none-eabi-readelf -S build/pebble-app.elf 
Maximum overlay section size = 0x1...
Generate final LD s c ript 
Maximum overlay Size of main app section size 
= 0x1D00 + 0x2600 
Overlays technique 9 
4 / 8
Generate final LD s c ript 
Overlay Table 
Overlays technique 10 
4 / 8
S ec ond build of the app 
Overlays technique 11 
pebble build 
Every section will be mapped in its correct 
position than...
E xtrac t overlays from elf 
Extract the compiled code in the overlay 
sections to one unique resource binary 
file. 
Over...
T hird and final build of the app 
Overlays technique 13 
pebble build 
Pack the previously generated binary 
resource in ...
Trim the elf file 
Remove the extracted overlay compiled 
code from the elf file to reduce its size 
(optional) 
Overlays ...
T he app is ready ! 
Overlays technique 15
How to load an overlay ? 
Overlays technique 16
How to load an overlay ? 
Overlays technique 17
Pos s ible applic ations 
If your app can be divided in 
independant parts, 
more parts can be added. 
Example: 
Heap Usag...
Adjus ting c ode for overlay 
● Change any string array from form of c ons t c har* days [] to 
c ons t c har days [][12] ...
Overlays technique 20 
Challenges 
● Overlay slot 
● Debugging information
Try it 
Some apps in the appstore : 
- F inally (12 watchfaces in one) 
- PPOSDemo (concept for a point of sale 
demo) wit...
Upcoming SlideShare
Loading in …5
×

Overlay Technique | Pebble Developer Retreat 2014

1,007 views

Published on

You can find the video presentation here: http://youtu.be/VhVjCnF-Y0M

Ron Ravid and Grégoire Sage cover the Overlay technique and how to load parts of code from resources.

Day 2 - Video 4

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Overlay Technique | Pebble Developer Retreat 2014

  1. 1. Overlays Tec hnique Ron & Grégoire
  2. 2. What's an overlay ? In a general computing sense, overlaying means "replacement of a block of stored instructions or data with another." Overlaying is a programming method that allows programs to be larger than the computer's main memory. http://www.wikiwand.com/en/Overlay Overlays technique 2
  3. 3. Overlay mapping Overlays technique 3
  4. 4. Our Build Proc es s 1.Generate an initial LD script 2.First build of the app 3.Calculate the size of the overlay sections 4.Generate final LD script 5.Second build of the app 6.Extract overlays sections from the elf to external resource file 7.Trim elf file to remove overlays section 8.Very final build Overlays technique 4
  5. 5. Generate the initial LD s c ript Overlay configuration Selecting files (from sources or libraries) for every overlay section Overlays technique 5 1 / 8
  6. 6. Generate the initial LD s c ript Overlays technique 6 Generated LD script 1 / 8
  7. 7. F irs t build of the app Overlays technique 7 pebble build The overlays sections are mapped at a default hard-coded position 2 / 8
  8. 8. Calc ulate the overlay s ec tion s ize arm-none-eabi-readelf -S build/pebble-app.elf Maximum overlay section size = 0x1D00 Overlays technique 8 3 / 8
  9. 9. Generate final LD s c ript Maximum overlay Size of main app section size = 0x1D00 + 0x2600 Overlays technique 9 4 / 8
  10. 10. Generate final LD s c ript Overlay Table Overlays technique 10 4 / 8
  11. 11. S ec ond build of the app Overlays technique 11 pebble build Every section will be mapped in its correct position thanks to the final LD script 5 / 8
  12. 12. E xtrac t overlays from elf Extract the compiled code in the overlay sections to one unique resource binary file. Overlays technique 12 6 / 8
  13. 13. T hird and final build of the app Overlays technique 13 pebble build Pack the previously generated binary resource in the app 7 / 8
  14. 14. Trim the elf file Remove the extracted overlay compiled code from the elf file to reduce its size (optional) Overlays technique 14 8 / 8
  15. 15. T he app is ready ! Overlays technique 15
  16. 16. How to load an overlay ? Overlays technique 16
  17. 17. How to load an overlay ? Overlays technique 17
  18. 18. Pos s ible applic ations If your app can be divided in independant parts, more parts can be added. Example: Heap Usage for App <Pebblets>: Total Size <3632B> Used <2928B> Still allocated <40B> Only 700 bytes remaining... Any application that not all of its parts are active simultaneously Overlays technique 18
  19. 19. Adjus ting c ode for overlay ● Change any string array from form of c ons t c har* days [] to c ons t c har days [][12] (one-two bytes bigger than length of your longest string.) ● If you use GPath, move your GPath data to external file with setup function ● menu_layer_set_callbacks. Instead of defining 'MenuLayerCallbacks menu_callbacks' and giving it to that function as parameter, put it directly inside the 3rd parameter of menu_layer_set_callbacks like: (MenuL ayerC allbac ks ){ .get_num_rows = get_num_rows , .draw_row = draw_row, .s elec t_c lic k = s elec t_c lic k }); ● vibes_enqueue_custom_pattern. Move your custom pattern to external non-overlay file. Overlays technique 19
  20. 20. Overlays technique 20 Challenges ● Overlay slot ● Debugging information
  21. 21. Try it Some apps in the appstore : - F inally (12 watchfaces in one) - PPOSDemo (concept for a point of sale demo) with source code, & detailed readme - Pebble Demos (all the SDK demos + compass in one app) with source code * check the links to source code on GitHub Overlays technique 21

×