|
| 1 | +# Copyright 2014-present PlatformIO <[email protected]> |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +# |
| 16 | +# Default flags for bare-metal programming (without any framework layers) |
| 17 | +# |
| 18 | + |
| 19 | +from os.path import join |
| 20 | + |
| 21 | +from SCons.Script import Import |
| 22 | + |
| 23 | +Import("env") |
| 24 | + |
| 25 | +env.Append( |
| 26 | + ASFLAGS=["-x", "assembler-with-cpp"], |
| 27 | + |
| 28 | + CFLAGS=[ |
| 29 | + "-std=gnu99", |
| 30 | + "-Wpointer-arith", |
| 31 | + "-Wno-implicit-function-declaration", |
| 32 | + "-Wl,-EL", |
| 33 | + "-fno-inline-functions", |
| 34 | + "-nostdlib" |
| 35 | + ], |
| 36 | + |
| 37 | + CCFLAGS=[ |
| 38 | + "-Os", # optimize for size |
| 39 | + "-mlongcalls", |
| 40 | + "-mtext-section-literals", |
| 41 | + "-falign-functions=4", |
| 42 | + "-U__STRICT_ANSI__", |
| 43 | + "-ffunction-sections", |
| 44 | + "-fdata-sections" |
| 45 | + ], |
| 46 | + |
| 47 | + CXXFLAGS=[ |
| 48 | + "-fno-rtti", |
| 49 | + "-fno-exceptions", |
| 50 | + "-std=c++11" |
| 51 | + ], |
| 52 | + |
| 53 | + CPPDEFINES=[ |
| 54 | + ("F_CPU", "$BOARD_F_CPU"), |
| 55 | + "__ets__", |
| 56 | + "ICACHE_FLASH" |
| 57 | + ], |
| 58 | + |
| 59 | + LINKFLAGS=[ |
| 60 | + "-Os", |
| 61 | + "-nostdlib", |
| 62 | + "-Wl,--no-check-sections", |
| 63 | + "-u", "call_user_start", |
| 64 | + "-u", "_printf_float", |
| 65 | + "-u", "_scanf_float", |
| 66 | + "-Wl,-static", |
| 67 | + "-Wl,--gc-sections" |
| 68 | + ], |
| 69 | + |
| 70 | + CPPPATH=[ |
| 71 | + join("$SDK_ESP8266_DIR", "include"), "$PROJECTSRC_DIR" |
| 72 | + ], |
| 73 | + |
| 74 | + LIBPATH=[ |
| 75 | + join("$SDK_ESP8266_DIR", "lib"), |
| 76 | + join("$SDK_ESP8266_DIR", "ld") |
| 77 | + ], |
| 78 | + |
| 79 | + LIBS=[ |
| 80 | + "c", "gcc", "phy", "pp", "net80211", "lwip", "wpa", "wpa2", |
| 81 | + "main", "wps", "crypto", "json", "ssl", "pwm", "upgrade", |
| 82 | + "smartconfig", "airkiss", "at" |
| 83 | + ] |
| 84 | +) |
| 85 | + |
| 86 | +# copy CCFLAGS to ASFLAGS (-x assembler-with-cpp mode) |
| 87 | +env.Append(ASFLAGS=env.get("CCFLAGS", [])[:]) |
| 88 | + |
| 89 | +env.Replace( |
| 90 | + UPLOAD_ADDRESS="0x40000" |
| 91 | +) |
0 commit comments