Toyomasa Watarai
/
test_big-size_program
Test program to generate big ROM size bin file
main.cpp@2:4262f7e2aa9e, 2015-04-28 (annotated)
- Committer:
- MACRUM
- Date:
- Tue Apr 28 01:49:03 2015 +0000
- Revision:
- 2:4262f7e2aa9e
- Parent:
- 1:d1898c185d3c
- Child:
- 3:3eae9fc3effb
Added address mapping for LPC11U68 and LPC1549 target
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MACRUM | 0:d7492cf9dab6 | 1 | #include "mbed.h" |
MACRUM | 0:d7492cf9dab6 | 2 | |
MACRUM | 0:d7492cf9dab6 | 3 | DigitalOut myled(LED1); |
MACRUM | 0:d7492cf9dab6 | 4 | Serial pc(USBTX, USBRX); |
MACRUM | 0:d7492cf9dab6 | 5 | |
MACRUM | 0:d7492cf9dab6 | 6 | #define ARRAY_SIZE (64*1024) |
MACRUM | 0:d7492cf9dab6 | 7 | const char data[ARRAY_SIZE] = {0}; |
MACRUM | 0:d7492cf9dab6 | 8 | |
MACRUM | 1:d1898c185d3c | 9 | #pragma no_inline |
MACRUM | 1:d1898c185d3c | 10 | |
MACRUM | 1:d1898c185d3c | 11 | #if defined(TARGET_LPC4337) |
MACRUM | 1:d1898c185d3c | 12 | int foo1(int x) __attribute__((section(".ARM.__at_0x1A010000"))); |
MACRUM | 1:d1898c185d3c | 13 | int foo2(int x) __attribute__((section(".ARM.__at_0x1A020000"))); |
MACRUM | 1:d1898c185d3c | 14 | int foo3(int x) __attribute__((section(".ARM.__at_0x1A012000"))); |
MACRUM | 2:4262f7e2aa9e | 15 | #elif defined(TARGET_LPC11U68) |
MACRUM | 2:4262f7e2aa9e | 16 | int foo1(int x) __attribute__((section(".ARM.__at_0x00018000"))); |
MACRUM | 2:4262f7e2aa9e | 17 | int foo2(int x) __attribute__((section(".ARM.__at_0x00020000"))); |
MACRUM | 2:4262f7e2aa9e | 18 | int foo3(int x) __attribute__((section(".ARM.__at_0x00011000"))); |
MACRUM | 2:4262f7e2aa9e | 19 | #elif defined(TARGET_LPC1549) |
MACRUM | 2:4262f7e2aa9e | 20 | int foo1(int x) __attribute__((section(".ARM.__at_0x00020000"))); |
MACRUM | 2:4262f7e2aa9e | 21 | int foo2(int x) __attribute__((section(".ARM.__at_0x00030000"))); |
MACRUM | 2:4262f7e2aa9e | 22 | int foo3(int x) __attribute__((section(".ARM.__at_0x0003B000"))); |
MACRUM | 2:4262f7e2aa9e | 23 | #else |
MACRUM | 2:4262f7e2aa9e | 24 | int foo1(int x); |
MACRUM | 2:4262f7e2aa9e | 25 | int foo2(int x); |
MACRUM | 2:4262f7e2aa9e | 26 | int foo3(int x); |
MACRUM | 1:d1898c185d3c | 27 | #endif |
MACRUM | 0:d7492cf9dab6 | 28 | |
MACRUM | 0:d7492cf9dab6 | 29 | int main() { |
MACRUM | 0:d7492cf9dab6 | 30 | pc.printf("data = %d, %d, %d\n", data[0], data[ARRAY_SIZE/2], data[ARRAY_SIZE - 1]); |
MACRUM | 0:d7492cf9dab6 | 31 | pc.printf("foo1(123) = %d\n", foo1(123)); |
MACRUM | 0:d7492cf9dab6 | 32 | pc.printf("foo2(123) = %d\n", foo2(123)); |
MACRUM | 1:d1898c185d3c | 33 | pc.printf("foo3(123) = %d\n", foo3(123)); |
MACRUM | 0:d7492cf9dab6 | 34 | while(1) { |
MACRUM | 0:d7492cf9dab6 | 35 | myled = 1; |
MACRUM | 0:d7492cf9dab6 | 36 | wait(0.2); |
MACRUM | 0:d7492cf9dab6 | 37 | myled = 0; |
MACRUM | 0:d7492cf9dab6 | 38 | wait(0.2); |
MACRUM | 0:d7492cf9dab6 | 39 | } |
MACRUM | 0:d7492cf9dab6 | 40 | } |
MACRUM | 0:d7492cf9dab6 | 41 | |
MACRUM | 0:d7492cf9dab6 | 42 | int foo1(int x) |
MACRUM | 0:d7492cf9dab6 | 43 | { |
MACRUM | 0:d7492cf9dab6 | 44 | return (x+1); |
MACRUM | 0:d7492cf9dab6 | 45 | } |
MACRUM | 0:d7492cf9dab6 | 46 | |
MACRUM | 0:d7492cf9dab6 | 47 | int foo2(int x) |
MACRUM | 0:d7492cf9dab6 | 48 | { |
MACRUM | 1:d1898c185d3c | 49 | return (x+2); |
MACRUM | 0:d7492cf9dab6 | 50 | } |
MACRUM | 1:d1898c185d3c | 51 | |
MACRUM | 1:d1898c185d3c | 52 | int foo3(int x) |
MACRUM | 1:d1898c185d3c | 53 | { |
MACRUM | 1:d1898c185d3c | 54 | return (x+3); |
MACRUM | 1:d1898c185d3c | 55 | } |