Implement a secure ICS protocol targeting LoRa Node151 microcontroller for controlling irrigation.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

78 lines
2.7 KiB

  1. # Copyright 2022 John-Mark Gurney.
  2. #
  3. # Redistribution and use in source and binary forms, with or without
  4. # modification, are permitted provided that the following conditions
  5. # are met:
  6. # 1. Redistributions of source code must retain the above copyright
  7. # notice, this list of conditions and the following disclaimer.
  8. # 2. Redistributions in binary form must reproduce the above copyright
  9. # notice, this list of conditions and the following disclaimer in the
  10. # documentation and/or other materials provided with the distribution.
  11. #
  12. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  13. # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  14. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  15. # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  16. # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  17. # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  18. # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  19. # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  20. # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  21. # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  22. # SUCH DAMAGE.
  23. #
  24. .if $(.OBJDIR) == $(.CURDIR)
  25. .error Need to set MAKEOBJDIR.
  26. .endif
  27. .MAIN: all
  28. .PHONY: all
  29. PROGEXT = .elf
  30. DEPENDS += .arm_deps
  31. .for i in $(PROGS)
  32. ALLTGTS+= $(i)$(PROGEXT) $(i).list $(i).sysinit
  33. ASRCS.$(i) = $(SRCS) $(SRCS.$(i))
  34. OBJS.$(i) = $(ASRCS.$(i):C/.c$/.o/)
  35. ARM_DEP_SRCS+= $(ASRCS.$(i))
  36. $(i)$(PROGEXT) $(i).map: $(OBJS.$(i))
  37. $(ARMCC) $(ARMTARGET) -o $(i)$(PROGEXT) $(.ALLSRC) -T$(LINKER_SCRIPT) --specs=nosys.specs -Wl,-Map="$(i).map" -Wl,--gc-sections -static --specs=nano.specs -Wl,--start-group -lc -lm -Wl,--end-group
  38. $(i).sysinit: $(ASRCS.$(i))
  39. grep ^SYSINIT $(.ALLSRC) | sort -k 2 -k 3 > $@ || (rm -f $@ && false)
  40. $(i).list: $(i)$(PROGEXT)
  41. $(ARMOBJDUMP) -h -S $(.ALLSRC) > $@ || (rm -f $@ && false)
  42. .endfor
  43. .PHONY: depend
  44. depend: $(DEPENDS)
  45. .arm_deps: $(ARM_DEP_SRCS)
  46. .arm_deps:
  47. $(ARMCC) $(ARMTARGET) $(CFLAGS) $(.ALLSRC) -MM > $@ || (rm -f $@ && false)
  48. .for i in $(DEPENDS)
  49. .sinclude "$i"
  50. .endfor
  51. all: $(ALLTGTS)
  52. .PHONY: runbuild
  53. runbuild: $(SRCS) Makefile mk/*.mk
  54. for i in $(EXTRA_DEPENDS) $(.MAKEFILE_LIST) $(.ALLSRC) $$(cat $(DEPENDS) | gsed ':x; /\\$$/ { N; s/\\\n//; tx }' | sed -e 's/^[^:]*://'); do if [ "$$i" != ".." ]; then echo $$i; fi; done | sort -u | entr -d sh -c 'echo starting...; cd $(.CURDIR) && $(MAKE) $(.MAKEFLAGS) depend && $(MAKE) $(.MAKEFLAGS) all'
  55. # native objects
  56. .SUFFIXES: .no
  57. .c.no:
  58. $(CC) $(CFLAGS) -c $< -o $@
  59. .c.o:
  60. $(ARMCC) $(ARMTARGET) $(CFLAGS) -c $< -o $@