Author Topic: question about align statement and aligning memory  (Read 6171 times)

Offline Kryptos

  • Jr. Member
  • *
  • Posts: 5
question about align statement and aligning memory
« on: May 16, 2011, 10:29:35 PM »
cpu_physical equ 1f000000h

align cpu_physical + 000000h
times 256 dq 0xdata,0xdata,0xdata,0xdata,0xdata,0xdata,0xdata,0xdata,0xdata,0xdata,0xdata,0xdata,0xdata,0xdata,0xdata,0xdata

align cpu_physical + 100000h
times 256 dq 0xdata,0xdata,0xdata,0xdata,0xdata,0xdata,0xdata,0xdata,0xdata,0xdata,0xdata,0xdata,0xdata,0xdata,0xdata,0xdata

this will actually do what I need which is to align the data at the addresses indicated, however, is there a way to
suppress the writing of data after the first "times 256 dq 0xdata" command executes? after it writes my data 256x it fills out the rest of memory with 90's up to where the next group of 256 lines of data starts. I have a script that takes the object file produced and converts it back into a hex file, which I need to hand edit for what I am ultimately trying to do...loading the processor with code and data through the jtag port.

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: question about align statement and aligning memory
« Reply #1 on: May 17, 2011, 06:37:57 AM »
Well, you could make it some other byte than "nop"... "align cpu_physical + 100000h, db 0" (or some other byte). I don't think there's any way to suppress the padding entirely - that's what "align" does.

http://www.nasm.us/xdoc/2.09.08/html/nasmdoc4.html#section-4.11.12

I'm not familiar with the requirements of JTAG, so perhaps I don't understand what you're trying to do. "0xdata" is not a valid number, of course, so I ASSume that's just "for example"? Is this going to be "instructions" that actually need to be assembled? Or literally "data"? Then you assemble this, convert it back to hex, and hand edit the result (a rather large file, no?)... Seems like there must be an easier way! Would a second section with "vstart=cpu_physical + 100000h" help you?

There was, until recently, a bug in "align" in "-f bin" mode (I suppose you're using "-f bin" for this?), so use a recent version!

I'm not sure I understand the question, Kryptos. (you are aptly named, perhaps! :) )

Best,
Frank


Offline Kryptos

  • Jr. Member
  • *
  • Posts: 5
Re: question about align statement and aligning memory
« Reply #2 on: May 17, 2011, 07:43:23 AM »
Well, the jist of what we are doing is loading the L2 cache with both data and instructions through the JTAG port and then running the code from the L2. There are certain pieces of code that take forever to simulate and generate a file that can be used on an ATE tester. This is a method for trying to get around that sticky test issue. And it provides other test benefits as well.

You answered my question about the padding, and I think I'll try your vstart method in the morning to see if it achieves what I am trying to do. I do have multiple sections of data like you described. This process is still in its infancy so there is still a lot of hand editing to do with files.