Currently, the changes that Robert Roland made in freepascal
are compatible with the file that Raspberry recognizes by default
'kernel7.img' without changing or adding the config.txt file.
The compiler is expected to automatically generate the file 'kernel7.img'
like other bare metal compilers including "Ultibo".
For Raspberry, the other files generated with the extension '.bin', '.hex' and '.elf' are not necessary.
That is why I made this simple change, which only affects when compiling for the Raspberry:
{$ifdef ARM}
if success then
begin
if (current_settings.controllertype = ct_raspi2) then
begin
success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O binary '+ FixedExeFileName + ' kernel7.img',true,false);
DeleteFile(FixedExeFileName);
DeleteFile(current_module.exefilename + '.hex');
DeleteFile(current_module.exefilename + '.bin');
end;
end;
{$endif ARM}
Currently, the original is:
if success and (target_info.system in [system_arm_embedded,system_avr_embedded,system_mipsel_embedded,system_xtensa_embedded]) then
begin
success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O ihex '+
FixedExeFileName+' '+
maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.hex'))),true,false);
if success then
success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O binary '+
FixedExeFileName+' '+
maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.bin'))),true,false);
end;
Now it remains:
if success and (target_info.system in [system_arm_embedded,system_avr_embedded,system_mipsel_embedded,system_xtensa_embedded]) then
begin
success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O ihex '+
FixedExeFileName+' '+
maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.hex'))),true,false);
if success then
success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O binary '+
FixedExeFileName+' '+
maybequoted(ScriptFixFileName(ChangeFileExt(current_module.exefilename,'.bin'))),true,false);
{$ifdef ARM}
if success then
begin
if (current_settings.controllertype = ct_raspi2) then
begin
success:=DoExec(FindUtil(utilsprefix+'objcopy'),'-O binary '+ FixedExeFileName + ' kernel7.img',true,false);
DeleteFile(FixedExeFileName);
DeleteFile(current_module.exefilename + '.hex');
DeleteFile(current_module.exefilename + '.bin');
end;
end;
{$endif ARM}
end;
And I've verified that that change is only reflected when I compile for Raspberry (-WpRASPI2).
For everyone else, it remains the same.