Guest User

Untitled

a guest
Jun 22nd, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. ** Generate a pure Mecrisp-Stellaris image for STM32F103 with serial i/o
  2.  
  3. #+BEGIN_EXAMPLE
  4.  
  5. cd $O/embello-1.6/explore/1608-forth/g6s
  6. awk -f fpp.awk board36.hex > /tmp/forth-code.fs
  7.  
  8. cd $O/mecrisp-stellaris-2.4.1/mecrisp-stellaris-source/stm32f103-ra
  9. make
  10. cd $O/mecrisp-stellaris-2.4.1/thumbulator
  11. ./compile
  12. ./buildcore-stm ./thumbulator-stm32f103 \
  13. ../mecrisp-stellaris-source/stm32f103-ra/mecrisp-stellaris-stm32f103.bin \
  14. /tmp/forth-code.fs /tmp/image.bin
  15.  
  16. #+END_EXAMPLE
  17.  
  18. from :board.fs:
  19. - included proper pins36.fs
  20. - removed eraseflash from the beginning
  21. - added definition of cornerstone
  22. - removed calling of old init
  23.  
  24. #+BEGIN_EXAMPLE fpp.awk
  25. BEGIN { FS=" " }
  26. /^include / || /^require / {
  27. print "\\ " $0
  28. system("awk -f fpp.awk " $2)
  29. next }
  30. {
  31. sub(/ \\ .*/, "")
  32. print }
  33. #+END_EXAMPLE
  34.  
  35. #+BEGIN_EXAMPLE board36.fs
  36. \ board definitions
  37.  
  38. \ eraseflash
  39. \ cr
  40. compiletoflash
  41.  
  42. ( board start: ) here dup hex.
  43.  
  44. 4 constant io-ports \ A..D
  45.  
  46. include ../flib/mecrisp/calltrace.fs
  47. include ../flib/mecrisp/cond.fs
  48. include ../flib/mecrisp/hexdump.fs
  49. include ../flib/stm32f1/io.fs
  50. include ../flib/pkg/pins36.fs
  51. include ../flib/stm32f1/hal.fs
  52. include ../flib/stm32f1/spi.fs
  53. include ../flib/stm32f1/i2c.fs
  54. include ../flib/stm32f1/timer.fs
  55. include ../flib/stm32f1/pwm.fs
  56. include ../flib/stm32f1/adc.fs
  57. include ../flib/stm32f1/rtc.fs
  58.  
  59. : cornerstone ( "name" -- ) \ define a flash memory cornerstone
  60. <builds begin here dup flash-pagesize 1- and while 0 h, repeat
  61. does> begin dup dup flash-pagesize 1- and while 2+ repeat cr
  62. eraseflashfrom ;
  63.  
  64. : hello ( -- ) flash-kb . ." KB <g6s> " hwid hex.
  65. $10000 compiletoflash here - flashvar-here compiletoram here -
  66. ." ram/flash: " . . ." free " ;
  67.  
  68. : init ( -- ) \ board initialisation
  69. \ init \ uses new uart init convention
  70. ['] ct-irq irq-fault ! \ show call trace in unhandled exceptions
  71. jtag-deinit \ disable JTAG, we only need SWD
  72. 72MHz
  73. 1000 systick-hz
  74. hello ." ok." cr
  75. ;
  76.  
  77. cornerstone <<<board>>>
  78. hello
  79. words
  80. #+END_EXAMPLE
Add Comment
Please, Sign In to add comment