diff --git a/simpleelf/elf_builder.py b/simpleelf/elf_builder.py
index 525f70f..f1b9329 100644
--- a/simpleelf/elf_builder.py
+++ b/simpleelf/elf_builder.py
@@ -1,10 +1,9 @@
 from collections import namedtuple
-
 from construct import Padding
-from simpleelf.elf_consts import ELFCLASS32
 
-from simpleelf.elf_structs import ElfStructs
 from simpleelf import elf_consts
+from simpleelf.elf_consts import ELFCLASS32
+from simpleelf.elf_structs import ElfStructs
 
 
 class ElfBuilder:
@@ -99,10 +98,11 @@ def add_section(self, type_, address, size, name, flags):
         self._e_shnum += 1
         self._sections.append(section)
 
-    def add_code_section(self, name, address, size):
-        self.add_section(self._structs.Elf_SectionType.SHT_PROGBITS, address,
-                         size,
-                         name, elf_consts.SHF_ALLOC | elf_consts.SHF_EXECINSTR)
+    def add_code_section(self, name: str, address: int, size: int, writeable: bool = False):
+        flags = elf_consts.SHF_ALLOC | elf_consts.SHF_EXECINSTR
+        if writeable:
+            flags |= elf_consts.SHF_WRITE
+        self.add_section(self._structs.Elf_SectionType.SHT_PROGBITS, address, size, name, flags)
 
     def add_empty_data_section(self, name, address, size):
         self.add_section(self._structs.Elf_SectionType.SHT_NOBITS, address,