View Issue Details

IDProjectCategoryView StatusLast Update
0037052FPCPatchpublic2020-05-14 23:17
ReporterReynaldo Assigned ToFlorian  
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:

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.,49672.msg361774.html#msg361774
TagsNo tags attached.
Fixed in Revision45365
Attached Files



2020-05-11 21:55


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+' '+
+      {$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}    
   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 ( 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.


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