Test program to generate big ROM size bin file

Dependencies:   mbed

main.cpp

Committer:
MACRUM
Date:
2015-04-28
Revision:
2:4262f7e2aa9e
Parent:
1:d1898c185d3c
Child:
3:3eae9fc3effb

File content as of revision 2:4262f7e2aa9e:

#include "mbed.h"

DigitalOut myled(LED1);
Serial pc(USBTX, USBRX);

#define ARRAY_SIZE (64*1024)
const char data[ARRAY_SIZE] = {0};

#pragma no_inline

#if defined(TARGET_LPC4337)
int foo1(int x) __attribute__((section(".ARM.__at_0x1A010000")));
int foo2(int x) __attribute__((section(".ARM.__at_0x1A020000")));
int foo3(int x) __attribute__((section(".ARM.__at_0x1A012000")));
#elif defined(TARGET_LPC11U68)
int foo1(int x) __attribute__((section(".ARM.__at_0x00018000")));
int foo2(int x) __attribute__((section(".ARM.__at_0x00020000")));
int foo3(int x) __attribute__((section(".ARM.__at_0x00011000")));
#elif defined(TARGET_LPC1549)
int foo1(int x) __attribute__((section(".ARM.__at_0x00020000")));
int foo2(int x) __attribute__((section(".ARM.__at_0x00030000")));
int foo3(int x) __attribute__((section(".ARM.__at_0x0003B000")));
#else
int foo1(int x);
int foo2(int x);
int foo3(int x);
#endif

int main() {
    pc.printf("data = %d, %d, %d\n", data[0], data[ARRAY_SIZE/2], data[ARRAY_SIZE - 1]);
    pc.printf("foo1(123) = %d\n", foo1(123));
    pc.printf("foo2(123) = %d\n", foo2(123));
    pc.printf("foo3(123) = %d\n", foo3(123));
    while(1) {
        myled = 1;
        wait(0.2);
        myled = 0;
        wait(0.2);
    }
}

int foo1(int x)
{
    return (x+1);
}

int foo2(int x)
{
    return (x+2);
}

int foo3(int x)
{
    return (x+3);
}