Toyomasa Watarai
/
test_big-size_program
Test program to generate big ROM size bin file
main.cpp@1:d1898c185d3c, 2015-04-27 (annotated)
- Committer:
- MACRUM
- Date:
- Mon Apr 27 14:12:39 2015 +0000
- Revision:
- 1:d1898c185d3c
- Parent:
- 0:d7492cf9dab6
- Child:
- 2:4262f7e2aa9e
Add some more test functions in address boundary
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 | 1:d1898c185d3c | 15 | #endif |
MACRUM | 0:d7492cf9dab6 | 16 | |
MACRUM | 0:d7492cf9dab6 | 17 | int main() { |
MACRUM | 0:d7492cf9dab6 | 18 | pc.printf("data = %d, %d, %d\n", data[0], data[ARRAY_SIZE/2], data[ARRAY_SIZE - 1]); |
MACRUM | 0:d7492cf9dab6 | 19 | pc.printf("foo1(123) = %d\n", foo1(123)); |
MACRUM | 0:d7492cf9dab6 | 20 | pc.printf("foo2(123) = %d\n", foo2(123)); |
MACRUM | 1:d1898c185d3c | 21 | pc.printf("foo3(123) = %d\n", foo3(123)); |
MACRUM | 0:d7492cf9dab6 | 22 | while(1) { |
MACRUM | 0:d7492cf9dab6 | 23 | myled = 1; |
MACRUM | 0:d7492cf9dab6 | 24 | wait(0.2); |
MACRUM | 0:d7492cf9dab6 | 25 | myled = 0; |
MACRUM | 0:d7492cf9dab6 | 26 | wait(0.2); |
MACRUM | 0:d7492cf9dab6 | 27 | } |
MACRUM | 0:d7492cf9dab6 | 28 | } |
MACRUM | 0:d7492cf9dab6 | 29 | |
MACRUM | 0:d7492cf9dab6 | 30 | int foo1(int x) |
MACRUM | 0:d7492cf9dab6 | 31 | { |
MACRUM | 0:d7492cf9dab6 | 32 | return (x+1); |
MACRUM | 0:d7492cf9dab6 | 33 | } |
MACRUM | 0:d7492cf9dab6 | 34 | |
MACRUM | 0:d7492cf9dab6 | 35 | int foo2(int x) |
MACRUM | 0:d7492cf9dab6 | 36 | { |
MACRUM | 1:d1898c185d3c | 37 | return (x+2); |
MACRUM | 0:d7492cf9dab6 | 38 | } |
MACRUM | 1:d1898c185d3c | 39 | |
MACRUM | 1:d1898c185d3c | 40 | int foo3(int x) |
MACRUM | 1:d1898c185d3c | 41 | { |
MACRUM | 1:d1898c185d3c | 42 | return (x+3); |
MACRUM | 1:d1898c185d3c | 43 | } |