TSLOCATE.DOC 4.9 KB

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