# HG changeset patch
# User Ideenmodellierer
# Date 1532880961 -7200
# Node ID a6580170de6f360536b3723058abdfc2beb21c96
# Parent  f39206facb9378ef6811af3fe4d6d3fbb24308f8
Added instruction to optimize for size
and to remove upper section from binary output

diff -r f39206facb93 -r a6580170de6f wiki/Detailed CPU1-Discovery Project.md
--- a/wiki/Detailed CPU1-Discovery Project.md	Sun Jul 29 18:09:58 2018 +0200
+++ b/wiki/Detailed CPU1-Discovery Project.md	Sun Jul 29 18:16:01 2018 +0200
@@ -29,6 +29,8 @@
 2. Right on it, select `Properties`, `Resource` and set `Text file encoding` to **UTF-8**
 3. Right on it, select `Properties`, `Resource` then `Linked Resources` and click on `New...` to define a new variable **OSTC4** that points to your source folder **D:\Dev\OSTC4** (or whatever path you used on your system).    
 This should allow to change the project's origin with a single variable change.
+4. Right on it, select `Properties`, `Settings`, `Optimization` and set `Optimization Level` to **Optimize for size (-Os)**
+
 
 # Add Sources Folders #
 
@@ -75,6 +77,13 @@
 1. Select your top-level project, right-click to edit `properties`. In `C/C++ Build` choose `Settings`, then `MCU G++ Linker` and `General`.
 And select _linker Script_: `OSTC4/Common/CPU1-F429.ld`
 
+
+## Prepare generation of bin file
+1. Select your top-level project, right-click to edit `properties`. In `C/C++ Build` choose `Settings`, then tab `Build Steps` and `Post build step command`.
+2. Add option -R .upper* to the command to removed the upper memory section, which is provided by the font library => 
+`arm-none-eabi-objcopy -R .upper* -O binary "${BuildArtifactFileBaseName}.elf" "${BuildArtifactFileBaseName}.bin"; arm-none-eabi-size "${BuildArtifactFileName}"`
+
+
 ## Build ELF firmware ##
 
 1. Click the `Build` button (hammer icon) on the top bar.
\ No newline at end of file