Header of Prime G1 firmware image is added at compile time

Replacing external header data with preamble data.
External file size correction is still needed. Maybe this could be done
in linker script?
This commit is contained in:
Stefan Achatz 2020-04-23 21:36:50 +02:00
parent e02deed273
commit ca3d05fab2
4 changed files with 20 additions and 5 deletions

View file

@ -7,15 +7,22 @@
#include <newrpl.h>
__ARM_MODE__ void startup(int) __attribute__((naked, noreturn));
void startup(int prevstate)
static void setup_hardware()
{
// Set 3 LED pins as outputs
uint32_t config = *GPCCON;
config &= 0xFFFF03FF;
config |= 0x00005400;
*GPCCON = config;
}
__ARM_MODE__ void startup(int) __attribute__((naked, noreturn));
void startup(int prevstate)
{
setup_hardware();
uint32_t pins = *GPCDAT;
// Pin GPC7 is red LED
pins |= 0x000000E0;
*GPCDAT = pins;

View file

@ -15,9 +15,7 @@ SEARCH_DIR(".");
SECTIONS
{
. = 0x30000020;
__code_start = . ;
. = 0x30000000;
/* all other sections here */
.interp : { *(.interp) }

View file

@ -7,6 +7,16 @@
#include "target_prime1.h"
unsigned char preamble[0x20] __attribute__((section(".preamble"))) = {
0x20, 0x00, 0x00, 0x30,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x30,
0x00, 0x00, 0x10, 0x00,
0x56, 0x35, 0x4A, 0x00, 0x32, 0x34, 0x31, 0x36,
0x00, 0x00, 0x00, 0x00
};
extern void startup(int);
void _boot(int prevstate) __attribute__((naked))

Binary file not shown.