Skip to content

Commit 5b707f6

Browse files
savacezarmarian14teodutu
authored andcommitted
chapters/{memory-layout,stack}: Add tasks and reading material for C - Assembly interaction
Created standalone makefiles for solutions. Added messages in readmes to point to the path of the exercices. Modified `config.yaml` and removed guides from this lab. Signed-off-by: cezar <savacezarmarian14@gmail.com> Signed-off-by: Teodor Dutu <teodor.dutu@gmail.com>
1 parent 6fa6eaf commit 5b707f6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+1658
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Repair Export Problems
2+
3+
Navigate to `drills/tasks/export-fix/support/`.
4+
5+
Each subdirectory (`support/a-func/`, `suppoer/b-var/`, `support/c-var-2/`) contains a problem related to exporting some symbols (functions or variables).
6+
In each subdirectory, run the `make` command, identify the problem and edit the files needed to fix the problem.
7+
8+
If you're having difficulties solving this exercise, go through [this relevant section](../../../reading/memory-layout-c-asm.md) reading material.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/main
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../support/a-func/Makefile
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
2+
3+
int hidden_value;
4+
5+
void init(void)
6+
{
7+
hidden_value = 0;
8+
}
9+
10+
void set(int value)
11+
{
12+
hidden_value = value;
13+
}
14+
15+
int get(void)
16+
{
17+
return hidden_value;
18+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
2+
3+
#include <stdio.h>
4+
#include "ops.h"
5+
6+
int main(void)
7+
{
8+
set(10);
9+
printf("get(): %d\n", get());
10+
11+
age = 33;
12+
print_age();
13+
14+
return 0;
15+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* SPDX-License-Identifier: BSD-3-Clause */
2+
3+
#ifndef OPS_H_
4+
#define OPS_H_ 1
5+
6+
void init(void);
7+
void set(int value);
8+
int get(void);
9+
10+
extern int age;
11+
void print_age(void);
12+
13+
#endif
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
2+
3+
#include <stdio.h>
4+
5+
int age;
6+
7+
void print_age(void)
8+
{
9+
printf("age: %d\n", age);
10+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/main
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../support/b-var/Makefile
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
2+
3+
static int hidden_value;
4+
5+
void init(void)
6+
{
7+
hidden_value = 0;
8+
}
9+
10+
void set(int value)
11+
{
12+
hidden_value = value;
13+
}
14+
15+
int get(void)
16+
{
17+
return hidden_value;
18+
}

0 commit comments

Comments
 (0)