]> code.bitgloo.com Git - clyne/calculator.git/commitdiff
fixed linker script
authorClyne Sullivan <tullivan99@gmail.com>
Tue, 27 Mar 2018 02:50:56 +0000 (22:50 -0400)
committerClyne Sullivan <tullivan99@gmail.com>
Tue, 27 Mar 2018 02:50:56 +0000 (22:50 -0400)
include/keypad.h
libinterp.a
link.ld
src/keypad.c
src/main.c

index 3dbebdf8ccc392f8a27c50145bf30596e109c0b4..5263a0d65b676215048067b604a5a9561e02e666 100644 (file)
@@ -28,6 +28,7 @@
  * Starts a task to poll the buttons. Must be called before any keypad reading.
  */
 void keypad_init(void);
+void keypad_start(void);
 
 /**
  * Reads the last pressed key on the keypad.
index c135dfcada4726243988951d049d3826890b2386..f00993242e5414ac266362cd0e4f61c02760a9bc 100644 (file)
Binary files a/libinterp.a and b/libinterp.a differ
diff --git a/link.ld b/link.ld
index be1c5236340034df4d3082ed52ca161bb74b5660..b7adb7819d1cfb8ab776c0ab7838553f59329b09 100644 (file)
--- a/link.ld
+++ b/link.ld
@@ -35,31 +35,45 @@ SECTIONS {
                . = ALIGN(8);
        } > FLASH
 
-       /* code sections */
+       /* other code sections */
        .text : {
                . = ALIGN(8);
                *(.text)
+               *(.text*)
+
+               *(.init)
+               *(.fini)
                . = ALIGN(8);
        } > FLASH
 
-       /* readonly data */
+       /* read-only data sections */
        .rodata : {
                . = ALIGN(8);
                *(.rodata)
+               *(.rodata*)
+
+               *(.eh_frame)
                . = ALIGN(8);
        } > FLASH
 
+       /* ARM stuff */
+       .ARM.exidx : {
+               *(.ARM.exidx)
+       } > FLASH
+
        /* init_array/fini_array (TODO understand this) */
        .init_array : {
-               PROVIDE_HIDDEN(__init_array_start = .);
-               KEEP(*(.init_array))
-               PROVIDE_HIDDEN(__init_array_end = .);
+               __init_array_start = .;
+               KEEP(*(SORT(.init_array.*)))
+               KEEP(*(.init_array*))
+               __init_array_end = .;
        } > FLASH
 
        .fini_array : {
-               PROVIDE_HIDDEN(__fini_array_start = .);
-               KEEP(*(.fini_array))
-               PROVIDE_HIDDEN(__fini_array_end = .);
+               __fini_array_start = .;
+               KEEP(*(SORT(.fini_array.*)))
+               KEEP(*(.fini_array*))
+               __fini_array_end = .;
        } > FLASH
 
        /* initialized data */
@@ -74,9 +88,10 @@ SECTIONS {
 
        /* uninitialized data */
        .bss : {
-               . = ALIGN(8);
+               . = ALIGN(4);
                __bss_start__ = .;
                *(.bss)
+               . = ALIGN(4);
                __bss_end__ = .;
        } > RAM
 }
index 06cef5196f6acd8fc12987600165c83ac048ac52..20a67c26973653587730d78e01a5984e632e16f0 100644 (file)
@@ -49,12 +49,12 @@ static const port_t keypad_cols[COLS] = {
        { COL_0 }, { COL_1 }, { COL_2 }, { COL_3 }, { COL_4 }
 };
 
-static const int keypad_map[ROWS][COLS] = {
-       { '7', '8', '9',  'x',  '/' },
-       { '4', '5', '6',  'y',  '*' },
-       { '3', '2', '1',  'z',  '-' },
-       { '.', '0', '\b', '\n', '+' }
-};
+//static const int keypad_map[ROWS][COLS] = {
+//     { '7', '8', '9',  'x',  '/' },
+//     { '4', '5', '6',  'y',  '*' },
+//     { '3', '2', '1',  'z',  '-' },
+//     { '.', '0', '\b', '\n', '+' }
+//};
 
 #define BUFFER_SIZE 8
 static char keypad_buffer = 'A';//[BUFFER_SIZE];
@@ -62,22 +62,22 @@ static char keypad_buffer = 'A';//[BUFFER_SIZE];
 
 void keypad_task(void)
 {
-       unsigned int col = 0;
+       //unsigned int col = 0;
        while (1) {
-               gpio_dout(keypad_cols[col].port, keypad_cols[col].pin, 1);
-               for (unsigned int row = 0; row < ROWS; row++) {
-                       if (gpio_din(keypad_rows[row].port, keypad_rows[row].pin)) {
-                               //if (keypad_buffer_pos < BUFFER_SIZE)
-                                       keypad_buffer/*[++keypad_buffer_pos]*/ = keypad_map[row][col];
-                               while (gpio_din(keypad_rows[row].port, keypad_rows[row].pin))
-                                       delay(1);
-                               break;
-                       }
-               }
-               gpio_dout(keypad_cols[col].port, keypad_cols[col].pin, 0);
-               col++;
-               if (col == COLS)
-                       col = 0;
+       //      gpio_dout(keypad_cols[col].port, keypad_cols[col].pin, 1);
+       //      for (unsigned int row = 0; row < ROWS; row++) {
+       //              if (gpio_din(keypad_rows[row].port, keypad_rows[row].pin)) {
+       //                      //if (keypad_buffer_pos < BUFFER_SIZE)
+       //                              keypad_buffer/*[++keypad_buffer_pos]*/ = keypad_map[row][col];
+       //                      while (gpio_din(keypad_rows[row].port, keypad_rows[row].pin))
+       //                              delay(1);
+       //                      break;
+       //              }
+       //      }
+       //      gpio_dout(keypad_cols[col].port, keypad_cols[col].pin, 0);
+       //      col++;
+       //      if (col == COLS)
+       //              col = 0;
 
                delay(10);
        }
@@ -102,7 +102,10 @@ void keypad_init(void)
                gpio_speed(p, pin, VERYHIGH);
                gpio_dout(p, pin, 0);
        }
+}
 
+void keypad_start(void)
+{
        task_start(keypad_task, 1024);
 }
 
index 1e9b58d529be4cd6c9741cbddf4e25b638548bb3..65fa1d3141e6d77b8f68d9a960a3c76286b3746b 100644 (file)
@@ -74,7 +74,7 @@ void kmain(void)
        dsp_init();\r
        dsp_rect(0, 0, LCD_WIDTH, LCD_HEIGHT, dsp_color(0, 0, 0));\r
        dsp_cursoron();\r
-       keypad_init();\r
+       keypad_start();\r
        task_start(task_interpreter, 4096);\r
 \r
        /*char buf[2];\r