Test program to generate big ROM size bin file

Dependencies:   mbed

main.cpp

Committer:
MACRUM
Date:
2015-04-27
Revision:
1:d1898c185d3c
Parent:
0:d7492cf9dab6
Child:
2:4262f7e2aa9e

File content as of revision 1:d1898c185d3c:

#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")));
#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);
}