75
75
# # BLACKLIST=/home/mydir/myBlackList
76
76
# VARIABLES=1700 # Sets number of variables for project defined firmware. This parameter can be dangerous, be careful before changing.
77
77
# # used in build_platform_config.py
78
+ # NO_COMPILE=1 # skips compiling and linking part, used to echo WRAPPERSOURCES only
78
79
79
80
ifndef GENDIR
80
81
GENDIR =$(shell pwd) /gen
@@ -481,10 +482,11 @@ EMBEDDED=1
481
482
BOARD =NRF52832DK
482
483
OPTIMIZEFLAGS+ =-O3
483
484
USE_BLUETOOTH =1
484
- DEFINES += -DBOARD_PCA10040
485
+ USE_NET =1
486
+ USE_GRAPHICS =1
487
+ DEFINES += -DBOARD_PCA10040 -DPCA10040
485
488
486
- # Uncomment to build Espruino to be transferred over DFU instead of flashed to the device.
487
- # DFU_UPDATE_BUILD=1
489
+ # DFU_UPDATE_BUILD=1 # Uncomment this to build Espruino for a device firmware update over the air.
488
490
489
491
else ifdef PUCKJS
490
492
EMBEDDED =1
@@ -497,6 +499,7 @@ USE_GRAPHICS=1
497
499
USE_FILESYSTEM =1
498
500
USE_CRYPTO =1
499
501
# USE_TLS=1
502
+ USE_NFC =1
500
503
501
504
else ifdef LPC1768
502
505
EMBEDDED =1
@@ -637,10 +640,10 @@ ifneq ("$(wildcard /usr/local/include/wiringPi.h)","")
637
640
USE_WIRINGPI =1
638
641
else
639
642
DEFINES+=-DSYSFS_GPIO_DIR ="\"/sys/class/gpio\""
640
- # $(info *************************************************************)
641
- # $(info * WIRINGPI NOT FOUND, and you probably want it *)
642
- # $(info * see http://wiringpi.com/download-and-install/ *)
643
- # $(info *************************************************************)
643
+ $(info *************************************************************)
644
+ $(info * WIRINGPI NOT FOUND, and you probably want it *)
645
+ $(info * see http ://wiringpi.com/download-and-install/ * )
646
+ $(info *************************************************************)
644
647
endif
645
648
646
649
else ifdef BEAGLEBONE
@@ -1047,6 +1050,11 @@ ifeq ($(BOARD),MICROBIT)
1047
1050
WRAPPERSOURCES += libs/microbit/jswrap_microbit.c
1048
1051
endif
1049
1052
1053
+ ifeq ($(BOARD ) ,PUCKJS)
1054
+ INCLUDE += -I$(ROOT ) /libs/puckjs
1055
+ WRAPPERSOURCES += libs/puckjs/jswrap_puck.c
1056
+ endif
1057
+
1050
1058
ifdef USE_CRYPTO
1051
1059
DEFINES += -DUSE_CRYPTO
1052
1060
INCLUDE += -I$(ROOT ) /libs/crypto
@@ -1306,13 +1314,13 @@ ifeq ($(FAMILY), NRF51)
1306
1314
1307
1315
SOFTDEVICE = $(NRF5X_SDK_PATH ) /components/softdevice/s130/hex/s130_nrf51_2.0.0_softdevice.hex
1308
1316
1309
- LINKER_FILE = $(NRF5X_SDK_PATH ) /../nrf5x_linkers/linker_nrf51_ble_espruino_$(LINKER_RAM ) .ld
1310
-
1311
1317
ifdef USE_BOOTLOADER
1318
+ LINKER_FILE = $(NRF5X_SDK_PATH ) /../nrf5x_linkers/linker_nrf51_ble_espruino_$(LINKER_RAM ) .ld
1312
1319
NRF_BOOTLOADER = $(ROOT ) /targetlibs/nrf5x/nrf5_singlebank_bl_hex/nrf51_s130_singlebank_bl.hex
1313
- NFR_BL_START_ADDR = 0x3C000
1320
+ NFR_BL_START_ADDR = 0x3C000# see dfu_gcc_nrf51.ld
1314
1321
NRF_BOOTLOADER_SETTINGS = $(ROOT ) /targetlibs/nrf5x/nrf5_singlebank_bl_hex/bootloader_settings_nrf51.hex # This file writes 0x3FC00 with 0x01 so we can flash the application with the bootloader.
1315
-
1322
+ else
1323
+ LINKER_FILE = $(NRF5X_SDK_PATH ) /../nrf5x_linkers/linker_nrf51_ble_espruino_$(LINKER_RAM ) .ld
1316
1324
endif
1317
1325
1318
1326
endif # FAMILY == NRF51
@@ -1337,24 +1345,31 @@ ifeq ($(FAMILY), NRF52)
1337
1345
1338
1346
SOFTDEVICE = $(NRF5X_SDK_PATH ) /components/softdevice/s132/hex/s132_nrf52_2.0.0_softdevice.hex
1339
1347
1340
- LINKER_FILE = $(NRF5X_SDK_PATH ) /../nrf5x_linkers/linker_nrf52_ble_espruino.ld # TODO: Should have separate linkers like is done in nrf_bootloader branch.
1341
-
1342
1348
ifdef USE_BOOTLOADER
1343
1349
NRF_BOOTLOADER = $(ROOT ) /targetlibs/nrf5x/nrf5_singlebank_bl_hex/nrf52_s132_singlebank_bl.hex
1344
- NFR_BL_START_ADDR = 0x7A000
1350
+ NFR_BL_START_ADDR = 0x7A000 # see Makefile, dfu_gcc_nrf52.ld, linker_nrf52_ble_espruino_bootloader.ld and dfu_types.h
1345
1351
NRF_BOOTLOADER_SETTINGS = $(ROOT ) /targetlibs/nrf5x/nrf5_singlebank_bl_hex/bootloader_settings_nrf52.hex # Writes address 0x7F000 with 0x01.
1352
+ ifdef BOOTLOADER
1353
+ # we're trying to compile the bootloader itself
1354
+ LINKER_FILE = $(NRF5X_SDK_PATH ) /../nrf5x_linkers/dfu_gcc_nrf52.ld
1355
+ OPTIMIZEFLAGS =-Os # try to reduce bootloader size
1356
+ else
1357
+ LINKER_FILE = $(NRF5X_SDK_PATH ) /../nrf5x_linkers/linker_nrf52_ble_espruino_bootloader.ld
1358
+ endif
1359
+ else
1360
+ LINKER_FILE = $(NRF5X_SDK_PATH ) /../nrf5x_linkers/linker_nrf52_ble_espruino.ld
1346
1361
endif
1347
1362
endif # FAMILY == NRF52
1348
1363
1349
1364
1350
- ifdef NFC
1365
+ ifdef USE_NFC
1351
1366
DEFINES += -DUSE_NFC
1352
- INCLUDE += -I$(NRF5X_SDK_PATH ) /components/drivers_nrf/clock
1353
1367
INCLUDE += -I$(NRF5X_SDK_PATH ) /components/nfc/t2t_lib
1354
1368
INCLUDE += -I$(NRF5X_SDK_PATH ) /components/nfc/ndef/uri
1355
1369
INCLUDE += -I$(NRF5X_SDK_PATH ) /components/nfc/ndef/generic/message
1356
1370
INCLUDE += -I$(NRF5X_SDK_PATH ) /components/nfc/ndef/generic/record
1357
1371
TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/drivers_nrf/clock/nrf_drv_clock.c
1372
+ TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/libraries/util/app_util_platform.c
1358
1373
TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/nfc/ndef/uri/nfc_uri_msg.c
1359
1374
TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/nfc/ndef/uri/nfc_uri_rec.c
1360
1375
TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/nfc/ndef/generic/message/nfc_ndef_msg.c
@@ -1440,7 +1455,6 @@ ifeq ($(FAMILY), EFM32GG)
1440
1455
endif # FAMILY == EFM32
1441
1456
1442
1457
ifdef NRF5X
1443
-
1444
1458
# Just try and get rid of the compile warnings.
1445
1459
CFLAGS += -Wno-sign-conversion -Wno-conversion -Wno-unused-parameter -fomit-frame-pointer # this is for device manager in nordic sdk
1446
1460
DEFINES += -DBLUETOOTH -D$(BOARD )
@@ -1454,10 +1468,19 @@ ifdef NRF5X
1454
1468
1455
1469
# These files are the Espruino HAL implementation.
1456
1470
INCLUDE += -I$(ROOT ) /targets/nrf5x
1457
- SOURCES += \
1458
- targets/nrf5x/main.c \
1459
- targets/nrf5x/jshardware.c \
1460
- targets/nrf5x/nrf5x_utils.c
1471
+ ifdef BOOTLOADER
1472
+ BUILD_LINKER_FLAGS+ =--bootloader
1473
+ PROJ_NAME =$(BOOTLOADER_PROJ_NAME )
1474
+ WRAPPERSOURCES =
1475
+ SOURCES = \
1476
+ targets/nrf5x_dfu/main.c \
1477
+ targets/nrf5x_dfu/dfu_ble_svc.c
1478
+ else
1479
+ SOURCES += \
1480
+ targets/nrf5x/main.c \
1481
+ targets/nrf5x/jshardware.c \
1482
+ targets/nrf5x/nrf5x_utils.c
1483
+ endif
1461
1484
1462
1485
# Careful here.. All these includes and sources assume a SoftDevice. Not efficeint/clean if softdevice (ble) is not enabled...
1463
1486
INCLUDE += -I$(NRF5X_SDK_PATH ) /components
@@ -1487,6 +1510,7 @@ ifdef NRF5X
1487
1510
INCLUDE += -I$(NRF5X_SDK_PATH ) /components/drivers_nrf/twi_master
1488
1511
INCLUDE += -I$(NRF5X_SDK_PATH ) /components/drivers_nrf/ppi
1489
1512
INCLUDE += -I$(NRF5X_SDK_PATH ) /components/drivers_nrf/hal/nrf_pwm
1513
+ INCLUDE += -I$(NRF5X_SDK_PATH)/components/drivers_nrf/clock
1490
1514
1491
1515
TARGETSOURCES += \
1492
1516
$(NRF5X_SDK_PATH ) /components/libraries/util/app_error.c \
@@ -1509,7 +1533,8 @@ ifdef NRF5X
1509
1533
$(NRF5X_SDK_PATH ) /components/drivers_nrf/hal/nrf_nvmc.c \
1510
1534
$(NRF5X_SDK_PATH ) /components/drivers_nrf/twi_master/nrf_drv_twi.c \
1511
1535
$(NRF5X_SDK_PATH ) /components/drivers_nrf/ppi/nrf_drv_ppi.c \
1512
- $(NRF5X_SDK_PATH ) /components/drivers_nrf/hal/nrf_adc.c
1536
+ $(NRF5X_SDK_PATH ) /components/drivers_nrf/hal/nrf_adc.c \
1537
+ $(NRF5X_SDK_PATH ) /components/drivers_nrf/clock/nrf_drv_clock.c
1513
1538
1514
1539
# $(NRF5X_SDK_PATH)/components/libraries/util/nrf_log.c
1515
1540
@@ -1524,6 +1549,40 @@ ifdef NRF5X
1524
1549
$(NRF5X_SDK_PATH ) /components/ble/ble_services/ble_dfu/ble_dfu.c \
1525
1550
$(NRF5X_SDK_PATH ) /components/libraries/bootloader_dfu/bootloader_util.c \
1526
1551
$(NRF5X_SDK_PATH ) /components/libraries/bootloader_dfu/dfu_app_handler.c
1552
+ ifdef BOOTLOADER
1553
+ DEFINES += -DBOOTLOADER
1554
+ INCLUDE += -I$(NRF5X_SDK_PATH ) /components/libraries/crc16
1555
+ INCLUDE += -I$(NRF5X_SDK_PATH ) /components/libraries/scheduler
1556
+ INCLUDE += -I$(NRF5X_SDK_PATH ) /components/libraries/hci
1557
+ INCLUDE += -I$(NRF5X_SDK_PATH ) /components/libraries/bootloader_dfu/ble_transport
1558
+
1559
+ TARGETSOURCES = # Make sure we don't include existing files (thanks to pstorage)
1560
+ TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/libraries/util/app_error.c
1561
+ TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/libraries/scheduler/app_scheduler.c
1562
+ TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/libraries/timer/app_timer.c
1563
+ TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/libraries/timer/app_timer_appsh.c
1564
+ TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/libraries/util/app_util_platform.c
1565
+ TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/libraries/bootloader_dfu/bootloader.c
1566
+ TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/libraries/bootloader_dfu/bootloader_settings.c
1567
+ TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/libraries/bootloader_dfu/bootloader_util.c
1568
+ TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/libraries/crc16/crc16.c
1569
+ TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/libraries/bootloader_dfu/dfu_single_bank.c
1570
+ TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/libraries/bootloader_dfu/dfu_init_template.c
1571
+ TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/libraries/bootloader_dfu/dfu_transport_ble.c
1572
+ TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/libraries/hci/hci_mem_pool.c
1573
+ TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/libraries/util/nrf_assert.c
1574
+ TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/drivers_nrf/delay/nrf_delay.c
1575
+ TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/drivers_nrf/common/nrf_drv_common.c
1576
+ TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/drivers_nrf/pstorage/pstorage_raw.c
1577
+ TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/ble/common/ble_advdata.c
1578
+ TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/ble/common/ble_conn_params.c
1579
+ TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/ble/ble_services/ble_dfu/ble_dfu.c
1580
+ TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/ble/common/ble_srv_common.c
1581
+ TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/toolchain/system_nrf52.c
1582
+ TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/softdevice/common/softdevice_handler/softdevice_handler.c
1583
+ TARGETSOURCES += $(NRF5X_SDK_PATH ) /components/softdevice/common/softdevice_handler/softdevice_handler_appsh.c
1584
+ TARGETSOURCES += $(NRF5X_SDK_PATH)/components/drivers_nrf/clock/nrf_drv_clock.c
1585
+ endif
1527
1586
endif
1528
1587
1529
1588
endif # NRF5X
@@ -2009,11 +2068,18 @@ ifdef SOFTDEVICE # Shouldn't do this when we want to be able to perform DFU OTA!
2009
2068
ifdef USE_BOOTLOADER
2010
2069
ifdef DFU_UPDATE_BUILD
2011
2070
echo Not merging softdevice or bootloader with application
2071
+ scripts/nrfutil.exe dfu genpkg $(PROJ_NAME).zip --application $(PROJ_NAME).hex --application-version 0xff --dev-revision 1 --dev-type 1 --sd-req 0x81
2072
+ else
2073
+ ifdef BOOTLOADER
2074
+ echo Not merging anything with bootloader
2075
+ echo Copy $(PROJ_NAME).hex to $(NRF_BOOTLOADER) to update
2012
2076
else
2013
2077
echo Merging SoftDevice and Bootloader
2014
- scripts/hexmerge.py $(SOFTDEVICE) $(NRF_BOOTLOADER):$(NFR_BL_START_ADDR): $(PROJ_NAME).hex $(NRF_BOOTLOADER_SETTINGS) -o tmp.hex
2078
+ echo FIXME - had to set --overlap=replace
2079
+ scripts/hexmerge.py --overlap=replace $(SOFTDEVICE) $(NRF_BOOTLOADER) $(PROJ_NAME).hex $(NRF_BOOTLOADER_SETTINGS) -o tmp.hex
2015
2080
mv tmp.hex $(PROJ_NAME).hex
2016
2081
endif
2082
+ endif
2017
2083
else
2018
2084
echo Merging SoftDevice
2019
2085
scripts/hexmerge.py $(SOFTDEVICE) $(PROJ_NAME).hex -o tmp.hex
@@ -2032,7 +2098,11 @@ ifndef TRAVIS
2032
2098
bash scripts/check_size.sh $(PROJ_NAME).bin
2033
2099
endif
2034
2100
2101
+ ifdef NRF5X
2102
+ proj : $(PROJ_NAME ) .lst $(PROJ_NAME ) .hex
2103
+ else
2035
2104
proj : $(PROJ_NAME ) .lst $(PROJ_NAME ) .bin $(PROJ_NAME ) .hex
2105
+ endif
2036
2106
2037
2107
# proj: $(PROJ_NAME).lst $(PROJ_NAME).hex $(PROJ_NAME).srec $(PROJ_NAME).bin
2038
2108
@@ -2086,3 +2156,8 @@ clean:
2086
2156
$(Q ) rm -f $(PROJ_NAME ) .bin
2087
2157
$(Q ) rm -f $(PROJ_NAME ) .srec
2088
2158
$(Q ) rm -f $(PROJ_NAME ) .lst
2159
+
2160
+ # start make like this "make varsonly" to get all variables created and used during make process without compiling
2161
+ # this helps to better understand linking, or to find oddities
2162
+ varsonly :
2163
+ $(foreach v, $(.VARIABLES ) , $(info $(v ) = $($(v ) ) ) )
0 commit comments