Readme.txt 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. Copyright (C) 2011 by Ole Reinhardt <ole.reinhardt@embedded-it.de>,
  2. Thermotemp GmbH. All rights reserved.
  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. 3. Neither the name of the copyright holders nor the names of
  12. contributors may be used to endorse or promote products derived
  13. from this software without specific prior written permission.
  14. THIS SOFTWARE IS PROVIDED BY THERMOTEMP GMBH AND CONTRIBUTORS
  15. ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  16. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  17. FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THERMOTEMP
  18. GMBH OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  19. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  20. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  21. OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  22. AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  23. OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  24. THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  25. SUCH DAMAGE.
  26. For additional information see http://www.ethernut.de/
  27. Platform:
  28. =========
  29. This code is implemented for and tested with the following boards:
  30. CPUs:
  31. - AT91SAM7X256
  32. - AT91SAM7X512
  33. Boards:
  34. - at91sam7x_ek
  35. - olimex sam7-ex256
  36. - eNet-sam7X
  37. at91sam7x_bootloader:
  38. =====================
  39. This bootloader should be considered as a demo. It is designed as
  40. a standard Nut/OS application and therefor compilation results in
  41. quite large binaries (caused by the overhead that Nut/OS brings in)
  42. But at least this program is a fully functional TFTP bootloader which
  43. can be controled using the CONFBOOT struct data placed in NVmem
  44. (e.g. a flash sector).
  45. In contrast to e.g. bootmon, this bootloader extends the CONFBOOT struct
  46. by a field used to save an MD5 digest of the current application image.
  47. This ensures that the application code itself was not modified (e.g. by
  48. a misbehaving application that overwrites parts of the flash).
  49. It could also be enhanced by checking the MD5 digest of the current
  50. flash image against a MD5 checksum placed on the TFTP server to ensure
  51. integrity of the whole flashing process.
  52. Bootloader functionality:
  53. =========================
  54. As just mentioned above, this bootloader is just a normal Nut/OS
  55. application and therefor the code starts with initialisation of
  56. the UART (used to show debug informations) if debug output is enbled.
  57. Next, the function check_or_save_md5() is called. Depending of it's
  58. return code (0 == image is ok, -1 == image broken / saved md5 digest
  59. does not match) the image is started or the network will be initialised
  60. and the tftp download gets started.
  61. Booting of the application code is implemeted in function boot(), which
  62. is defined as ram resident code. To avoid any malfunction caused by
  63. interrupts generated during application initialisation (in crtxxx.S) all
  64. interrupts have to be disabled befor jumping into the application code.
  65. Same is done with all peripheral clocks. From the application point of
  66. view the jump to the application start address (0x0010C000 in this case)
  67. should behave the same way as if the application would be linked to address
  68. 0x000000000 and therefor would be started with a fresh initialised CPU.
  69. Bootloader configuration:
  70. =========================
  71. Debug output:
  72. Debug output is send to UART0 at 115200,8,N,1
  73. IP and TFTP settings:
  74. Take a look to debug.h, all configuration settings can be found there...
  75. Currently the bootloader just support a static configuration (static IP, static
  76. server IP etc.). One idea for enhancements would be support of the bootp
  77. protocol.
  78. Makefile / Nut/OS environment:
  79. Just compile this application in the same way as any other Nut/OS application
  80. too. Use the standard Nut/OS configuration (e.g. enet_sam7x.conf or
  81. olimex-sam7-ex256.conf
  82. Please adjust the path to the Makedefs and Makerules to fit your Nut/OS
  83. application directory settings.
  84. Application configuration:
  85. ==========================
  86. As the application code is placed into the flash with a configured offset
  87. of 48kByte (at address 0x0010C000) you have to make sure to use the correct
  88. linker script. Please change the following settings in the Nut/OS configurator:
  89. Nut/OS Components --> Tools --> GCC-Setings --> Linker script
  90. to use one of the bootrom linker scripts for the at91sam7x256_bootrom.ld or
  91. at91sam7x512_bootrom.ld
  92. How to retrigger the software download:
  93. If an application image is flashed, the download procedure will not start again
  94. after a power cycle or reset but the bootloader will directly start the
  95. application.
  96. To trigger the bootloader again, the MD5 checksum in the confnet struct (saved
  97. in the configured flash sector or NVMem) needs to be cleared.
  98. See the simple demo application code in the "demo" folder for an example...