View Issue Details

IDProjectCategoryView StatusLast Update
0037052FPCPatchpublic2020-05-14 23:17
ReporterReynaldo Assigned ToFlorian  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Fixed in Version3.3.1 
Summary0037052: The required file for the Raspberry is not generated in arm-embedded
DescriptionCurrently, the changes that Robert Roland made in freepascal are compatible with the file that Raspberry recognizes by default 'kernel7.img'.

However, compiling generates files:
'name.bin'
'name.hex'
'name.elf'

None of those extensions are recognized by the Raspberry.

It is necessary that when compiling for the Raspberry (-WpRASPI2) the file 'kernel7.img' is generated and the others are not.

https://forum.lazarus.freepascal.org/index.php/topic,49672.msg361774.html#msg361774
TagsNo tags attached.
Fixed in Revision45365
FPCOldBugId
FPCTarget-
Attached Files

Activities

Reynaldo

2020-05-11 21:55

reporter  

fix_image_created_raspi2.patch (1,021 bytes)   
diff --git a/compiler/systems/t_embed.pas b/compiler/systems/t_embed.pas
index 45d50b3162..556749a452 100644
--- a/compiler/systems/t_embed.pas
+++ b/compiler/systems/t_embed.pas
@@ -1653,6 +1653,18 @@ begin
         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;
 
   MakeExecutable:=success;   { otherwise a recursive call to link method }
fix_image_created_raspi2.patch (1,021 bytes)   

Christo Crause

2020-05-13 18:02

reporter   ~0122767

The default boot process (https://raspberrypi.stackexchange.com/a/10595) looks for specific kernel images by default. The image name can be specified by the user, but this entails editing config.txt on the boot card. Changing the binary file name to the expected kernel name for the selected architecture seems sensible, as proposed in the first part of the patch. This is also what Ultibo does.

The elf file could potentially be used for debugging so it doesn't seem prudent to delete this file. The hex file is probably not needed for transferring to the target in this case. Deleting the files right after creating them seems wasteful, but seem like an obvious fix if you want to minimize the patch.

Florian

2020-05-14 23:17

administrator   ~0122811

Thanks, applied. I removed the deletion of the intermediate files. The compiler normally leaves those laying around.

Issue History

Date Modified Username Field Change
2020-05-11 21:55 Reynaldo New Issue
2020-05-11 21:55 Reynaldo File Added: fix_image_created_raspi2.patch
2020-05-11 22:07 Bart Broersma Project Patches => FPC
2020-05-13 18:02 Christo Crause Note Added: 0122767
2020-05-14 23:16 Florian Assigned To => Florian
2020-05-14 23:16 Florian Status new => resolved
2020-05-14 23:16 Florian Resolution open => fixed
2020-05-14 23:16 Florian Fixed in Version => 3.3.1
2020-05-14 23:16 Florian Fixed in Revision => 45365
2020-05-14 23:16 Florian FPCTarget => -
2020-05-14 23:17 Florian Note Added: 0122811