Hello all.
I am not an experienced ruby programmer, but some time ago I developed an ARM Simulator Core for the m0 architecture that has been working for two years now both on Linux and Windows, and we use at our university for teaching computer architecture.
You can find more information following
http://lorca.act.uji.es/project/qtarmsim
Suddenly the simulator stopped working on my Windows 8.1 computer. Debugging the code I have arrived to the crashing code, that is
assemble = Proc.new { |entrada|
nf = entrada[0].split('.')[0]
fline = $path + nf
cline = '"' + $compiler + '"' + ' ' + $args + ' -Wa,-alcd' + ' -o ' + fline + '.o'
eline = '2>' + fline + '.err'
lline = '>' + fline + '.lst'
if system(cline + ' ' + fline + '.s ' + ' ' + lline + ' ' + eline)
blocks = read_ELF(fline + '.o')
procesador = Core.new(ThumbII_Defs::ARCH, blocks[0])
procesador.memory.add_block(blocks[1])
procesador.memory.symbolTable = blocks[2]
$symbol_table = blocks[2]
dirPC = $symbol_table['main']
dirPC = ORIG_CODE if dirPC.nil?
procesador.update({usr_regs: [ThumbII_Defs::PC, dirPC, ThumbII_Defs::SP, END_DATA - 128]})
$server.proc = procesador
$source = gen_source(fline + '.lst')
p $source
res = "SUCCESS\r\n"
else
res = "ERROR\r\n"
File.foreach(fline + '.err') do |line|
res = res + line[0..-2] + "\r\n"
end
res = res + "EOF\r\n"
end
File.delete(fline + '.err')
File.delete(fline + '.lst')
res
}
where the simulator calls the compiler to generate the obj file to obtain the machine code to simulate, the .lst to generate the assembly listing and the .err to report errors if any. Please forgive my bad ruby but this was my first (and only to date) ruby application.
As I have told, everything worked ok and works on many platforms but now, on my Windows 8.1 system -and I have to say it previously worked- it doesn't, and I observe:
The line sent to the shell by the system call is
"C:/Program Files (x86)/arduino-1.5.4/hardware/tools/g++_arm_none_eabi/bin/arm-none-eabi-gcc.exe" -mcpu=cortex-m1 -mthumb -c -Wa,-alcd -o program.o program.s >program.lst 2>program.err
and the shell reports the errors
arm-none-eabi-gcc.exe: >program.lst: Invalid argument
arm-none-eabi-gcc.exe: 2>program.err: Invalid argument
Which means that the redirections > and 2> are considered as parameters to the compiler and not correctly interpreted by the shell.
This happens with versions 1.93 and 2.2 of ruby. And what puzzles me the most is that it worked as the simulator has been being used for more than two years now!
Thank you very much for your attention.
Germán Fabregat.