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.

пре 3 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. Samples of GNU Tools for ARM Embedded Processors v4.7+
  2. * Directory structure *
  3. samples/startup - Startup code needed by samples
  4. /ldscripts - Shared linker script pieces needed by samples
  5. /src - Sample source code and Makefile, each sub-dir is a case
  6. * Build *
  7. For Windows, linux-like tools is required to run command like make and rm.
  8. These samples are tested with cygwin.
  9. To build all samples, set arm-none-eabi-gcc in path, cd src and make.
  10. The makefile is configured to use newlib-nano by default. To disable it,
  11. pass USE_NANO= to make command line like:
  12. $ make USE_NANO=
  13. The makefile is configured to build for Cortex-M0 by default. To build for
  14. M3, M4 or M7, pass CORTEX_M=3/4/7 respectively:
  15. $ make CORTEX_M=3
  16. * Porting *
  17. These samples are written in a way that easily porting to variant Cortex-M
  18. boards. Usually there are only two files you need modify for your boards.
  19. ldscripts/mem.ld defines address ranges for flash and RAM. Modify them to
  20. reflect start address and length of flash/RAM banks in your board, by
  21. following the embedded comments.
  22. src/retarget/retarget.c implements how to initialize UART, send/receive
  23. strings via UART. Since UART is configured and operated differently in
  24. different boards, you need put your board specific code in retarget.c
  25. to make UART work.
  26. Recommend to make clean after modifying mem.ld.
  27. * Sample cases introduction *
  28. ** minimum - A minimum skeleton to start a C program with limited features.
  29. This case has a empty main. Code size built from it is only about 150 bytes,
  30. since it has almost no "fat" for a Cortex-M C program. Be noticed that this
  31. case doesn't support semihosting or C++ global constructor/destructor.
  32. ** semihost - Show how to use semihosting for file IO.
  33. This case uses printf to output a string. Here printf is backup by
  34. semihosting, which does the real print job to a host machine.
  35. ** retarget - Show how to use retarget (UART) for standard IO.
  36. This case uses printf to output a string. Here printf is backup by retarget.
  37. There is a retarget.c showing which libc interfaces need overloading to
  38. re-direct file IO operations to on-board devices (usually UART). This case
  39. isn't complete, real board specific code need adding to make UART work.
  40. This case also doesn't support semihosting or C++ global
  41. constructor/destructor.
  42. ** fpout - Show how to print floating point.
  43. This case uses printf from newlib-nano to print floating point values. Since
  44. newlib-nano by default doesn't link code needed by floating point IO, this
  45. case demonstrates how to use this function in command line options. It also
  46. uses semihosting.
  47. ** fpin - Show how to input/output floating point.
  48. This case uses sscanf from newlib-nano to input floating point values. Since
  49. newlib-nano by default doesn't link code needed by floating point IO, this
  50. case demonstrates how to use this function in command line options. It also
  51. uses semihosting.
  52. ** qemu - Show how to build a Cortex-M bare-metal program running on qemu.
  53. This case builds a simple application that can run on qemu for ARM. It uses
  54. semihosting for file IO, which qemu supports.
  55. ** cpp - How to setup a C++ project
  56. This case builds a simple C++ application using memory allocator, integer IO
  57. and global constructor/destructor.
  58. ** multiram - How to use multiple RAM banks
  59. This case works with system with two RAM banks. It include startup and linker
  60. scripts that initializing multiple data sections and bss sections.