TSLOCATE.DOC 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. Creating Code with Absolute Addresses
  2. =====================================
  3. Your TechKit includes a program, TSLOCATE.EXE, that enables you to
  4. specify exactly where the various segments of your program are to
  5. be placed. This can be very useful for creating embedded programs,
  6. for putting your programs in PROM's or for making a bootable disk for a
  7. program that is to run without DOS.
  8. TSLOCATE is used to locate an MSDOS EXE-file. That is,
  9. the segments are allocated absolute segment values in the 8086
  10. 1-Mbyte memory space. The output is the binary image of the
  11. program.
  12. The memory layout for the target system is specified in the
  13. .MEM file, together with the linker classes which are to be
  14. put in the memory. For example:
  15. ram 100 60000 DATA Dummy BSS M_DATA STACK HEAP
  16. rom F8000 FFFF0 CODE F_CODE
  17. rom FFFF0 100000 BOOTCODE
  18. width 2
  19. Each line of the .MEM file must start with rom, ram or
  20. width.
  21. For rom and ram lines, these words are followed by two
  22. hexadecimal numbers, specifying the start and end absolute addresses
  23. of some memory in the target system configuration. The second address is a
  24. `stop' address, so that a warning can be produced if there is not
  25. enough memory. The addresses are followed by a list of class
  26. names, separated by spaces. The order of the names is not significant
  27. (the ordering is determined by the order in the link).
  28. The word width is followed by a number which should be 1, 2 or
  29. 4. The default is 1. This number specifies the target data bus
  30. width, in bytes. For example, width 2 indicates that the
  31. target data bus is 2 bytes wide, and causes two binary files to be
  32. produced --- one with the even bytes, one with the odd bytes. This is
  33. necessary because PROMs are normally only 1 byte wide, so in a system
  34. with a 16-bit data bus at least 2 PROMs will be required.
  35. TSLOCATE is invoked with a single parameter --- the file name,
  36. but not including the extension. For example
  37. tslocate myprog
  38. When invoked, TSLOCATE uses three input files:
  39. MYPROG.EXE
  40. the msdos excutable file
  41. MYPROG.MAP
  42. the map produced by the linker
  43. MYPROG.MEM
  44. the ASCII file specifying the memory layout
  45. The output files from TSLOCATE are:
  46. MYPROG.BN?
  47. the binary image(s)
  48. MYPROG.MP2
  49. the .MAP file with edited addresses
  50. Certain environments may have unusual code location requirements.
  51. One hint to keep in mind when dealing with such cases is the following:
  52. If the class names in the map file prove to be too "coarse," you can
  53. always edit the map file to change the class name for certain segments.
  54. Putting Things in (P)ROM
  55. The following considerations are important if you need to put
  56. code into ROM or into PROM
  57. Special arrangements must be made for segments which are initialised
  58. and subsequently modified. Probably the easiest method to start with
  59. is to avoid this situation, possibly by using the data pragma to specify
  60. that the initialised variables are placed in seperate segments, and not
  61. attempting to modify them. Note that string and floating point
  62. literals are equivalent to initialised data.
  63. An alternative idea is to run tslocate twice, the first time
  64. to create the code image, the second time to create the initialised
  65. data image. Then when the rom program starts execution it should copy
  66. the region of prom where the initialised data image is stored into
  67. the ram location where it is required during execution.
  68. Startup code for embedded systems
  69. =================================
  70. The INITESYS.A file is in the SRC directory.
  71. Your project should include initesys,corertl and coremain. Functions may also be
  72. imported from language standard libraries.
  73. 1) Do not use #link, as the point using INITESYS instead of INITEXE
  74. is to avoid bringing in all the standard library code. Instead, include
  75. a #compile for each part of the library that is required, then use
  76. #dolink.
  77. 2) In the module INITESYS.A the last line has 'end *', the * character
  78. being a command to the assembler to indicate the entry point.
  79. For example, if you have an assembler file V25LIB.A which implements some
  80. functions for your embedded system and has no initialization code, your
  81. project would look like this:
  82. ----------- EMBEDDED.MOD ------------------
  83. MODULE Embedded;
  84. IMPORT V25Lib;
  85. BEGIN
  86. .
  87. END Embedded.
  88. ------------- V25LIB.DEF ------------------
  89. (*# module( init_code => off) *)
  90. DEFINITION MODULE V25Lib;
  91. .
  92. END V25Lib.
  93. ------------ V25LIB.A -------------------
  94. .
  95. .
  96. .
  97. ----------- EMBEDDED.PR -----------------
  98. #system dos exe
  99. #model small jpi
  100. #compile initesys.a
  101. #compile embedded.mod
  102. #compile v25lib.a
  103. #compile coremain.a
  104. #compile corertl.a -- ditto for other required system independent
  105. -- parts of modula library
  106. #dolink embedded
  107. #run "tslocate embedded"
  108.