Test program to generate big ROM size bin file

Dependencies:   mbed

main.cpp

Committer:
MACRUM
Date:
2016-02-25
Revision:
3:3eae9fc3effb
Parent:
2:4262f7e2aa9e

File content as of revision 3:3eae9fc3effb:

#include "mbed.h"

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

#pragma no_inline

#if defined(TARGET_LPC1114) || defined(TARGET_SSCI824)
int foo1(int x) __attribute__((section(".ARM.__at_0x00000FF8")));
int foo2(int x) __attribute__((section(".ARM.__at_0x00004004")));
int foo3(int x) __attribute__((section(".ARM.__at_0x00007800")));
#elif defined(TARGET_HRM1017) || defined(TARGET_TY51822R3)
int foo1(int x) __attribute__((section(".ARM.__at_0x0001C200")));
int foo2(int x) __attribute__((section(".ARM.__at_0x00020000")));
int foo3(int x) __attribute__((section(".ARM.__at_0x00023F00")));
#elif 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")));
#elif defined(TARGET_RZ_A1H)
int foo1(int x) __attribute__((section(".ARM.__at_0x18004000")));
int foo2(int x) __attribute__((section(".ARM.__at_0x18005000")));
int foo3(int x) __attribute__((section(".ARM.__at_0x18006000")));
#elif defined(TARGET_LPC11U35_501)
int foo1(int x) __attribute__((section(".ARM.__at_0x00001000")));
int foo2(int x) __attribute__((section(".ARM.__at_0x00008000")));
int foo3(int x) __attribute__((section(".ARM.__at_0x0000F800")));
#else
int foo1(int x);
int foo2(int x);
int foo3(int x);
#endif


int main() {
    pc.printf("\n*** test start ***\n");
    pc.printf("Test : foo1 = %d\n", foo1(123));
    pc.printf("Test : foo2 = %d\n", foo2(123));
    pc.printf("Test : foo3 = %d\n", foo3(123));
    pc.printf("*** test end ***\n");
    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);
}